Skip to content

Commit

Permalink
Add test for #12259
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jul 17, 2018
1 parent a150b94 commit ed5ffb7
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/TestCase/ORM/TableTest.php
Expand Up @@ -1504,6 +1504,23 @@ class_alias($class, 'TestApp\Model\Entity\TestUser');
$this->assertEquals('TestApp\Model\Entity\TestUser', $table->getEntityClass());
}

/**
* Test that entity class inflection works for compound nouns
*
* @return void
*/
public function testEntityClassInflection()
{
$class = $this->getMockClass('\Cake\ORM\Entity');

if (!class_exists('TestApp\Model\Entity\CustomCookie')) {
class_alias($class, 'TestApp\Model\Entity\CustomCookie');
}

$table = $this->getTableLocator()->get('CustomCookies');
$this->assertEquals('TestApp\Model\Entity\CustomCookie', $table->getEntityClass());
}

/**
* Tests that using a simple string for entityClass will try to
* load the class from the Plugin namespace when using plugin notation
Expand Down
22 changes: 22 additions & 0 deletions tests/test_app/TestApp/Model/Table/CustomCookiesTable.php
@@ -0,0 +1,22 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @since 3.6.8
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
namespace TestApp\Model\Table;

use Cake\ORM\Table;

/**
* CustomCookies table class
*/
class CustomCookiesTable extends Table
{
}

0 comments on commit ed5ffb7

Please sign in to comment.