Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update use of deprecated MockBuilder::setMethods().
As a result TestCase::getMockModel() no longer accepts null or non existent methods for it's $methods argument.
- Loading branch information
Showing
2 changed files
with
7 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -753,12 +753,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|null $methods The list of methods to mock | ||
* @param array $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(string $alias, ?array $methods = [], array $options = []) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ADmad
Author
Member
|
||
public function getMockForModel(string $alias, array $methods = [], array $options = []) | ||
{ | ||
$className = $this->_getTableClassName($alias, $options); | ||
$connectionName = $className::defaultConnectionName(); | ||
|
@@ -772,7 +772,7 @@ public function getMockForModel(string $alias, ?array $methods = [], array $opti | |
|
||
/** @var \Cake\ORM\Table|\PHPUnit\Framework\MockObject\MockObject $mock */ | ||
$mock = $this->getMockBuilder($className) | ||
->setMethods($methods) | ||
->onlyMethods($methods) | ||
->setConstructorArgs([$options]) | ||
->getMock(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Please, this was something we had already discussed #12720