Skip to content
Permalink
Browse files

`getMockForModel()` method can take `null` for `$methods` parameter

  • Loading branch information...
mirko-pagliai committed Nov 11, 2018
1 parent d080e1d commit 76ee70085691a518e0fc2dbeaab51d1310a8cfe6
Showing with 12 additions and 2 deletions.
  1. +2 −2 src/TestSuite/TestCase.php
  2. +10 −0 tests/TestCase/TestSuite/TestCaseTest.php
@@ -673,12 +673,12 @@ protected function skipUnless($condition, $message = '')
* Mock a model, maintain fixtures and table association
*
* @param string $alias The model to get a mock for.
* @param array $methods The list of methods to mock
* @param array|null $methods The list of methods to mock
* @param array $options The config data for the mock's constructor.
* @throws \Cake\ORM\Exception\MissingTableClassException
* @return \Cake\ORM\Table|\PHPUnit_Framework_MockObject_MockObject
*/
public function getMockForModel($alias, array $methods = [], array $options = [])
public function getMockForModel($alias, $methods = [], array $options = [])
{
/** @var \Cake\ORM\Table $className */
$className = $this->_getTableClassName($alias, $options);
@@ -494,6 +494,16 @@ public function testGetMockForModelTable()
$entity = new Entity([]);
$this->assertTrue($Mock->save($entity));
$this->assertFalse($Mock->save($entity));
$Mock = $this->getMockForModel(
'Table',
null,
['alias' => 'Comments', 'className' => '\Cake\ORM\Table']
);
$result = $this->getTableLocator()->get('Comments');
$this->assertInstanceOf('Cake\ORM\Table', $result);
$this->assertEquals('Comments', $Mock->getAlias());
}
/**

0 comments on commit 76ee700

Please sign in to comment.
You can’t perform that action at this time.