Closed AshishKumarPundeer closed 1 year ago
Q | A |
---|---|
Documentation | no |
Bugfix | no |
BC Break | no |
New Feature | no |
RFC | no |
QA | yes |
Hmm, we probably need to rewrite the tests that rely on phpspec/prophecy
to use only PHPUnit mocking
@AshishKumarPundeer TODOs:
vendor/bin/phpcbf
ProphecyTrait
from tests @Ocramius Suggested changes has beed done.
@AshishKumarPundeer please look at the CI failures 😁
Hello @Ocramius Our PR is dependent on package phpspec/prophecy and they have added the support php 8.2 under this PR https://github.com/phpspec/prophecy/pull/571 which is not yet merged hence it seems once PR will be merged our PR will be green.
Please suggest way forward anything is required our end.
Thanks
Hey @AshishKumarPundeer, I already suggested to drop prophecy here, and use PHPUnit mocks instead.
Hello @Ocramius ,
Hey @AshishKumarPundeer, I already suggested to drop prophecy here, and use PHPUnit mocks instead.
It may be the silly question for you just for clarification can we use this phpspec/prophecy-phpunit or phpunit only.
Let's please phase out prophecy overall: PHPUnit only 👍
Let's please phase out prophecy overall: PHPUnit only 👍
We have already removed ProphecyTrait in tests file,Can you please suggest in which files we need to remove the prophecy now.
Effectively, ->prophesize()
calls need to be replaced with ->createMock()
(and associated API) in the test classes :)
Effectively,
->prophesize()
calls need to be replaced with->createMock()
(and associated API) in the test classes :)
we have used createMock() in place of prophesize() but below are some interfaces in which we are facing the issues. use Laminas\Di\InjectorInterface; use Psr\Log\LoggerInterface use Psr\Container\ContainerInterface;
eg. $container = $this->createMock(ContainerInterface::class)->reveal();
we have tried various things but it is not resolved yet please suggest what we should do for this.
Thanks
(and associated API)
@AshishKumarPundeer you may find it helpful to read the chapter on PHPUnit mocks here. reveal()
is part of the Prophecy api. There are some similarities between the mocking api of PHPUnit and prophecy, but you must review each mock individually and ensure that all of the expectations match the current test suite.
@AshishKumarPundeer instead of randomly push and wait CI to run test, you can verify locally first and make a commit only when all ok on your local dev:
./vendor/bin/phpcs -q --report=checkstyle
./vendor/bin/phpunit
@Ocramius @samsonasik All testcases are passing now, please review and merge the PR