Comments (8)
In this case you can just mock the ContainerBuilder instance and call the
build method :)
Otherwise you should create a full functional test for your bundle.
Op 23 apr. 2015 14:55 schreef "Sullivan SENECHAL" <[email protected]
:
Hi and thanks for this library, this gave me lot of time to make tests.
In your documentation, it's explain how to test Extenstion and
CompilerPass, but what about the Bundle class itself?For example, I would like to test the build method of this Bundle class:
Is that possible with your library? How?
Thanks.
—
Reply to this email directly or view it on GitHub
#45
.
from symfonydependencyinjectiontest.
Yeah just figure out how to do.
Is seems to be correct for you? https://github.com/Soullivaneuh/SLLHIsoCodesValidatorBundle/blob/master/tests/SLLHIsoCodesValidatorBundleTest.php
Thanks for your help. 👍
from symfonydependencyinjectiontest.
In my opinion this doesn't really add that much quality to the bundle test
suite. You'd be better of with a test that creates a kernel, registers a
bundle, boots the kernel and verifies that everything works.
Op 23 apr. 2015 16:48 schreef "Sullivan SENECHAL" <[email protected]
:
Yeah just figure out how to do.
Is seems to be correct for you?
https://github.com/Soullivaneuh/SLLHIsoCodesValidatorBundle/blob/master/tests/SLLHIsoCodesValidatorBundleTest.phpThanks for your help. [image: 👍]
—
Reply to this email directly or view it on GitHub
#45 (comment)
.
from symfonydependencyinjectiontest.
Hmm don't really understand.
My SLLHIsoCodesValidatorBundle class just add a compiler to the given container.
I just have to test what the class do, isn't it?
I should better improve test for TranslationPass.php class with resources presence check.
Thanks for your advice anyway. :-)
from symfonydependencyinjectiontest.
Well, you could also mock the ContainerBuilder
, call build()
and see if the call to addCompilerPass()
was made. However, this isn't a very interesting test.
Maybe take a look at this: https://github.com/SimpleBus/AsynchronousBundle/blob/master/tests/Functional/SimpleBusAsynchronousBundleTest.php It tests a bundle by testing if, when added to a kernel (https://github.com/SimpleBus/AsynchronousBundle/blob/master/tests/Functional/TestKernel.php) it integrates nicely, collects services by tag, etc.
from symfonydependencyinjectiontest.
Well, you could also mock the ContainerBuilder, call build() and see if the call to addCompilerPass() was made.
Also. But the test assertions goal will be the same, isn't it?
Thanks for examples, I'll take a look. 👍
from symfonydependencyinjectiontest.
Well, it's not really the same, since your test is now coupled to the implementation of ContainerBuilder
(since you expect 2 compiler passes, the second of which is your pass, which is too much knowledge about the internals of that class).
from symfonydependencyinjectiontest.
Closing this since there's no action required (right?).
from symfonydependencyinjectiontest.
Related Issues (20)
- failed to load vendor/autoload.php HOT 1
- LoaderFactory supporting .yaml extension
- Incompatibility with phpunit 8 HOT 2
- $container->getExtensionConfig() does not return minimal configuration
- Support for Symfony 5 HOT 3
- Assert container does not have a method call
- Lots of composer deprecation warnings about PSR-4 compliance HOT 2
- PHP8 Support HOT 1
- New release HOT 1
- False positive with assertContainerBuilderHasServiceDefinitionWithArgument
- Remove supported for Symfony 2.3 HOT 5
- Allow test DI-extenions that depends on another extensions and config
- it_lower_cases_aliased_service_ids fails HOT 2
- Next release HOT 1
- Add support for Symfony 4
- Investigate in build failure HOT 2
- Support tests for "Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface" HOT 1
- Add phpunit as a non-dev depedency. HOT 2
- 1.2.0 is not BC with 1.1.* HOT 3
- Declaration of Matthias\SymfonyDependencyInjectionTest\PhpUnit\DefinitionHasMethodCallConstraint::toString() must be compatible with PHPUnit\Framework\SelfDescribing::toString(): string
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from symfonydependencyinjectiontest.