Browse Source

Merge pull request #9574 from dakota/master

getMockForModel should use the correct alias for plugin models
Mark Story 9 years ago
parent
commit
b1acd2d40c
2 changed files with 2 additions and 0 deletions
  1. 1 0
      src/TestSuite/TestCase.php
  2. 1 0
      tests/TestCase/TestSuite/TestCaseTest.php

+ 1 - 0
src/TestSuite/TestCase.php

@@ -670,6 +670,7 @@ abstract class TestCase extends PHPUnit_Framework_TestCase
         }
 
         TableRegistry::set($baseClass, $mock);
+        TableRegistry::set($alias, $mock);
 
         return $mock;
     }

+ 1 - 0
tests/TestCase/TestSuite/TestCaseTest.php

@@ -490,6 +490,7 @@ class TestCaseTest extends TestCase
 
         $result = TableRegistry::get('TestPlugin.TestPluginComments');
         $this->assertInstanceOf('TestPlugin\Model\Table\TestPluginCommentsTable', $result);
+        $this->assertSame($TestPluginComment, $result);
 
         $TestPluginComment = $this->getMockForModel('TestPlugin.TestPluginComments', ['save']);