Giter Club home page Giter Club logo

Comments (8)

matthiasnoback avatar matthiasnoback commented on August 15, 2024

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:

https://github.com/Soullivaneuh/SLLHIsoCodesValidatorBundle/blob/master/src/SLLHIsoCodesValidatorBundle.php

Is that possible with your library? How?

Thanks.


Reply to this email directly or view it on GitHub
#45
.

from symfonydependencyinjectiontest.

soullivaneuh avatar soullivaneuh commented on August 15, 2024

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.

matthiasnoback avatar matthiasnoback commented on August 15, 2024

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.php

Thanks for your help. [image: 👍]


Reply to this email directly or view it on GitHub
#45 (comment)
.

from symfonydependencyinjectiontest.

soullivaneuh avatar soullivaneuh commented on August 15, 2024

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.

matthiasnoback avatar matthiasnoback commented on August 15, 2024

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.

soullivaneuh avatar soullivaneuh commented on August 15, 2024

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.

matthiasnoback avatar matthiasnoback commented on August 15, 2024

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.

matthiasnoback avatar matthiasnoback commented on August 15, 2024

Closing this since there's no action required (right?).

from symfonydependencyinjectiontest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.