From b6b8c24539d3cbc7aa9745c58b957f4f1147dcef Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 24 Jul 2018 22:33:10 +0530 Subject: [PATCH] Fix entity class inflection for mocked models. --- src/TestSuite/TestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TestSuite/TestCase.php b/src/TestSuite/TestCase.php index 541de8facee..d990a24dd89 100644 --- a/src/TestSuite/TestCase.php +++ b/src/TestSuite/TestCase.php @@ -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);