Fix more exception tests

This commit is contained in:
Ben Thomson 2020-01-19 22:26:21 +08:00
parent 2c529cf753
commit a4c34d1dea
No known key found for this signature in database
GPG Key ID: B2BAFACC5ED68F87
3 changed files with 8 additions and 11 deletions

View File

@ -23,12 +23,11 @@ class ModelTest extends PluginTestCase
$this->assertEquals(1, $post->id);
}
/**
* @expectedException \Illuminate\Database\Eloquent\MassAssignmentException
* @expectedExceptionMessage title
*/
public function testGuardedAttribute()
{
$this->expectException(\Illuminate\Database\Eloquent\MassAssignmentException::class);
$this->expectExceptionMessageMatches('/title/');
Post::create(['title' => 'Hi!', 'slug' => 'authenticity']);
}
}

View File

@ -165,12 +165,11 @@ class SimpleTreeModelTest extends PluginTestCase
], $array);
}
/**
* @expectedException \Exception
* @expectedExceptionMessage Column mismatch in listsNested method
*/
public function testListsNestedUnknownColumn()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Column mismatch in listsNested method');
CategorySimple::listsNested('custom_name', 'id');
}

View File

@ -13,11 +13,10 @@ class ValidationModelTest extends PluginTestCase
$this->runPluginRefreshCommand('Database.Tester');
}
/**
* @expectedException October\Rain\Database\ModelException
*/
public function testUniqueTableValidation()
{
$this->expectException(\October\Rain\Database\ModelException::class);
$post = ValidationPost::create([
'title' => 'This is a new post',
'slug' => 'post-1',