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/ValidationModelTest.php

<?php

use Database\Tester\Models\ValidationPost;

class ValidationModelTest 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 testUniqueTableValidation()
    {
        $this->expectException(\Winter\Storm\Database\ModelException::class);

        $post = ValidationPost::create([
            'title' => 'This is a new post',
            'slug' => 'post-1',
            'description' => 'Testing...'
        ]);

        $this->assertNotFalse($post);

        $post2 = ValidationPost::create([
            'title' => 'this is another post with the same slug',
            'slug' => 'post-1',
            'description' => 'testing....'
        ]);
    }
}