Skip to content

Commit

Permalink
Adding a test for the entity route exception
Browse files Browse the repository at this point in the history
  • Loading branch information
burzum committed Oct 8, 2017
1 parent a35638c commit 3a96c78
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/TestCase/Routing/Route/EntityRouteTest.php
Expand Up @@ -54,4 +54,25 @@ public function testMatchBasic()

$this->assertEquals('/articles/2/article-slug', $result);
}

/**
* Test invalid entity option value
*
* @expectedException \RuntimeException
* @expectedExceptionMessage Route `/` expects the URL option `_entity` to be `Cake\Datasource\EntityInterface`, but `string` passed.
*/
public function testInvalidEntityValueException()
{
$route = $route = new EntityRoute('/',
[
'_name' => 'articlesView',
'_entity' => 'Something else',
]
);

$route->match([
'_entity' => 'something-else',
'_name' => 'articlesView',
]);
}
}

0 comments on commit 3a96c78

Please sign in to comment.