| Q | A
| --------------------| ---------------
| PHPUnit version | 8.5.4
| PHP version | 7.3.11
| Installation Method | Composer
When I tried to mock an object Dibi/Fluent method from, the PhpUnit return the following message:
createPartialMock called with method(s) from that do not exist in Dibi\Fluent. This will not be allowed in future versions of PHPUnit.
Unfortunately the method select is valid callable method based on the magic __call.
When I create a mock with method that is valid and callable via __call but not exactly defined, the PhpUnit generate a warning.
public function testFoo(): void
{
$fluent = $this->createFluentMock(['from']);
// ...
}
/**
* Fluent mock factory
*
* @param string[] $methods [OPTIONAL] List of mocked method names
* @return \Dibi\Fluent|MockObject
*/
protected function createFluentMock(array $methods = []): MockObject
{
$mock = $this->createPartialMock(Fluent::class, $methods);
return $mock;
}
Don't generate this warning, when the class contain __call magic.
Thank you for your report.
Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting.
Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue.
Hello @sebastianbergmann, thanks for your fast reply.
I hope that this code helps you to understand better: https://github.com/zeleznypa/phpunit-4240/blob/master/tests/DibiTest.php
This is the typical usage of the Dibi/Fluent class: https://phpfashion.com/dibifluent-tekute-sql-prikazy
Sorry, but that is not self-contained.
@sebastianbergmann I'm sorry, but I don't know what does the self-contained mean.
The repository https://github.com/zeleznypa/phpunit-4240 contain everything to reproduce the bug.
Can you please send me an example of bug-report with self-contained example?
"self-contained" means no dependencies.
@sebastianbergmann Thanks for the patience.
The dependency on Dibi was replaced with minimal code example.
Hope that this is what you want :)
Hi, was there an outcome to satisfy the issue described here?
+1 ? Running into this issue while testing post method from the GuzzleHttp\Client class
Instead of configuring methods that do not exist, configure the method that does exist: __call().
Most helpful comment
Hi, was there an outcome to satisfy the issue described here?