Your IP : 216.73.216.79


Current Path : /var/www/html/dyna-laravel.blunetdev.com/tests/unit/plugins/database/
Upload File :
Current File : /var/www/html/dyna-laravel.blunetdev.com/tests/unit/plugins/database/PluginModelTest.php

<?php

use Database\Tester\Models\Post;

class PluginModelTest extends PluginTestCase
{
    public function setUp() : void
    {
        parent::setUp();

        include_once base_path().'/tests/fixtures/plugins/database/tester/models/Post.php';

        $this->runPluginRefreshCommand('Database.Tester');
    }

    public function testCreateFirstPost()
    {
        Post::truncate();
        $post = new Post;
        $post->title = "First post";
        $post->description = "Yay!!";
        $post->save();
        $this->assertEquals(1, $post->id);
    }

    public function testGuardedAttribute()
    {
        $this->expectException(\Illuminate\Database\Eloquent\MassAssignmentException::class);
        $this->expectExceptionMessageMatches('/title/');

        Post::create(['title' => 'Hi!', 'slug' => 'authenticity']);
    }
}