Skip to content

Commit

Permalink
Fix entity class inflection for mocked models.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Jul 24, 2018
1 parent 49dbe09 commit b6b8c24
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/TestSuite/TestCase.php
Expand Up @@ -699,7 +699,7 @@ public function getMockForModel($alias, array $methods = [], array $options = []

if (empty($options['entityClass']) && $mock->getEntityClass() === Entity::class) {
$parts = explode('\\', $className);
$entityAlias = Inflector::singularize(substr(array_pop($parts), 0, -5));
$entityAlias = Inflector::classify(Inflector::underscore(substr(array_pop($parts), 0, -5)));
$entityClass = implode('\\', array_slice($parts, 0, -1)) . '\\Entity\\' . $entityAlias;
if (class_exists($entityClass)) {
$mock->setEntityClass($entityClass);
Expand Down

0 comments on commit b6b8c24

Please sign in to comment.