phpDocumentor icon indicating copy to clipboard operation
phpDocumentor copied to clipboard

Rewrite Mockery calls to Prophecy

Open mvriel opened this issue 4 years ago • 5 comments

Many phpDocumentor tests use Mockery as a mocking/stubbing library but with the advent of prophecy, we are now working to adopt that as our library or method of choice.

To reduce the number of dependencies that we have and simplify our tests, we need all mockery uses to be rewritten to use prophecy.

Any help here is much appreciated. Please issue a PR per test as that will help in reviewing and merging.

mvriel avatar Jan 25 '20 08:01 mvriel

@mvriel As prophecy integration in PHPUnit is deprecated from version 9 and will be removed in version 10, do you still want to migrate to Prophecy or would it make sense to migrate to PHPUnit's built-in mocking library?

See sebastianbergmann/phpunit#4141

simivar avatar Oct 03 '20 18:10 simivar

However prophecy is removed from the phpunit core I think it is still superior to the phpunit mocks. I tried recently to improve the phpunit mocks and I was a bit disappointed about the internals. There are much edge cases which are not nicely covered.

So yes I do still prefer to migrate to prophecy.

jaapio avatar Oct 03 '20 18:10 jaapio

To reduce the number of dependencies that we have and simplify our tests

As I see in the issue description the point of this task was as well to simplify dependencies of phpDocumentator. If we got with prophecy we will just change dependency from Mockery to Prophecy. Isn't that right?

simivar avatar Oct 03 '20 19:10 simivar

Since phpdocumentor libraries are used by phpunit, mockery and prophecy it is always a pain to install more dependencies via composer.

We will need to find a way to install prophecy via phar like we do with phpunit right now. Removing mockery is a step forward. Phars can be scoped which prevents issues.

jaapio avatar Oct 03 '20 20:10 jaapio

I've opened two more PRs and if those get merged what will be left to do is:

  • [ ] Migrate phpDocumentor\Descriptor from Mockery to Prophecy (11 classes)
  • [x] Migrate phpDocumentor\Descriptor\Builder\Reflector from Mockery to Prophecy (7 classes)
  • [x] Migrate phpDocumentor\Descriptor\Builder\Reflector\Tags to Prophecy (9 classes)
  • [x] Migrate phpDocumentor\Descriptor\Filter to Prophecy (4 classes)
  • [ ] Migrate/refactor phpDocumentor\Faker\Provider class from Mockery

simivar avatar Oct 04 '20 13:10 simivar