Phpdocumentor: Rewrite Mockery calls to Prophecy

Created on 25 Jan 2020  路  5Comments  路  Source: phpDocumentor/phpDocumentor

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.

Up-for-grabs enhancement help wanted

Most helpful comment

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

  • [ ] Migrate phpDocumentorDescriptor from Mockery to Prophecy (11 classes)
  • [x] Migrate phpDocumentorDescriptorBuilderReflector from Mockery to Prophecy (7 classes)
  • [x] Migrate phpDocumentorDescriptorBuilderReflectorTags to Prophecy (9 classes)
  • [x] Migrate phpDocumentorDescriptorFilter to Prophecy (4 classes)
  • [ ] Migrate/refactor phpDocumentorFakerProvider class from Mockery

All 5 comments

@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

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.

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?

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.

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

  • [ ] Migrate phpDocumentorDescriptor from Mockery to Prophecy (11 classes)
  • [x] Migrate phpDocumentorDescriptorBuilderReflector from Mockery to Prophecy (7 classes)
  • [x] Migrate phpDocumentorDescriptorBuilderReflectorTags to Prophecy (9 classes)
  • [x] Migrate phpDocumentorDescriptorFilter to Prophecy (4 classes)
  • [ ] Migrate/refactor phpDocumentorFakerProvider class from Mockery
Was this page helpful?
0 / 5 - 0 ratings

Related issues

PhrozenByte picture PhrozenByte  路  5Comments

giovkanata picture giovkanata  路  5Comments

niden picture niden  路  4Comments

ilianiv picture ilianiv  路  3Comments

olvlvl picture olvlvl  路  6Comments