phpunit-injector

Injects services from a PSR-11 dependency injection container to PHPUnit test cases (by jakzal)

Phpunit-injector Alternatives

Similar projects and alternatives to phpunit-injector

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better phpunit-injector alternative or higher similarity.

phpunit-injector reviews and mentions

Posts with mentions or reviews of phpunit-injector. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-03-04.
  • Testing with immutable PSR-7 objects and Prophecy
    3 projects | dev.to | 4 Mar 2021
    This unit test will fail when ran against the implementation from earlier. And in this situation a failing test is a good thing. But for this specific situation another "issue" has made it's way into the testcase; the unit test is now depending on the implementation that is being used for PSR-7. When working in a large codebase - like I currently am - one might have more than just a few usages of these interfaces and thus unit tests. Using the suggested approach, instantiating value objects instead of prophesizing, will lead to a large amount of object instantiations. And this will make switching to another implementation more work. Ideally this instantiating is centralized as much as possible. This is exactly why PSR-17 - HTTP Factories - was introduced. Typically dependencies - like these factories - are injected. For unit tests this is not feasible without plugins. My solution is a bit less fancy; a trait:

Stats

Basic phpunit-injector repo stats
1
61
4.0
3 months ago

jakzal/phpunit-injector is an open source project licensed under MIT License which is an OSI approved license.

The primary programming language of phpunit-injector is PHP.


Sponsored
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com