Skip to content

Add integration tests against a Symfony app #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 15, 2014
Merged

Add integration tests against a Symfony app #39

merged 6 commits into from
Mar 15, 2014

Conversation

ddeboer
Copy link
Member

@ddeboer ddeboer commented Mar 10, 2014

No description provided.

<service id="fos_http_cache.proxy.log_subscriber"
class="FOS\HttpCache\EventListener\LogSubscriber"
abstract="true">
<argument type="service" id="logger" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would this need a on-invalid="true"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary as the service is defined as abstract. The LoggerPass will then make this service concrete only if the logger service is available.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay. the compiler pass plus config allow more than one way how to do things. makes sense, yes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I created the LoggerPass because I wasn’t sure how to implement the conditional method call (addSubscriber) in service XML. If you know a way, the LoggerPass may not be needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we can, we do such things in the DependencyInjection class (e.g. with the cmf) but i think in this case we can't know if the logger will be present or not.

i suggest we leave as is and hopefully eventually can simplify.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, for services outside the bundle you only know which ones will be available at compiler pass stage.

@dbu
Copy link
Contributor

dbu commented Mar 11, 2014

cool, looking good so far. i don't see the actual test here so i guess its not finished?

@ddeboer
Copy link
Member Author

ddeboer commented Mar 11, 2014

You’re right. I added ‘[WIP]’ to mark this unfinished.

@ddeboer
Copy link
Member Author

ddeboer commented Mar 15, 2014

Okay, added the first functional test. Have a look if you’re happy with the way I set it up.

->addDefaultsIfNotSet()
->treatFalseLike(array('enabled' => false))
->treatTrueLike(array('enabled' => true))
->treatNullLike(array('enabled' => true))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this not the same as using canBeEnabled ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems it is. I just copied from the other listeners in our config, so let’s change it there, too.

@dbu
Copy link
Contributor

dbu commented Mar 15, 2014

this looks really cool! impressive how little setup is needed, i like it.

and seems there is quite some bits to cleanup, i like the compiler pass to fail early and with a clear message what is wrong.

ddeboer added 3 commits March 15, 2014 14:00
Fix local Varnish IP

Rename services.xml to cache_manager.xml

Log to file not stdout
Improve doc

Remove unused fixture
Simplify config with canBeEnabled() and canBeDisabled()
@ddeboer
Copy link
Member Author

ddeboer commented Mar 15, 2014

Simplified the config and squashed commits. Please merge if you agree with the setup. We can then open separate PRs to add more functional tests and fix any issues that come up.

@dbu
Copy link
Contributor

dbu commented Mar 15, 2014

looks good yes. thanks!

i still see 6 commits - if you want to keep them, merge as is, otherwise push the squashing and then merge :-)

@ddeboer
Copy link
Member Author

ddeboer commented Mar 15, 2014

Yep, I’d like to keep those six. 😉

dbu added a commit that referenced this pull request Mar 15, 2014
Add integration tests against a Symfony app
@dbu dbu merged commit 340bc1c into master Mar 15, 2014
@dbu dbu deleted the app-tests branch March 15, 2014 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants