ORIENT/tests/unit/plugins/database/ValidationModelTest.php

35 lines
896 B
PHP
Raw Normal View History

2017-03-21 20:31:02 +00:00
<?php
use Database\Tester\Models\ValidationPost;
class ValidationModelTest extends \October\Core\Tests\PluginTestCase
2017-03-21 20:31:02 +00:00
{
2019-06-12 16:22:20 +00:00
public function setUp() : void
2017-03-21 20:31:02 +00:00
{
parent::setUp();
include_once base_path().'/tests/fixtures/plugins/database/tester/models/Post.php';
$this->runPluginRefreshCommand('Database.Tester');
}
2017-03-21 20:33:35 +00:00
public function testUniqueTableValidation()
2017-03-21 20:31:02 +00:00
{
2020-01-19 14:26:21 +00:00
$this->expectException(\October\Rain\Database\ModelException::class);
2017-03-21 20:31:02 +00:00
$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....'
]);
}
}