Skip to content
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

Extract test functionality #103

Merged
merged 4 commits into from
Aug 5, 2014
Merged

Extract test functionality #103

merged 4 commits into from
Aug 5, 2014

Conversation

ddeboer
Copy link
Member

@ddeboer ddeboer commented Aug 2, 2014

Fix #101.

@dbu
Copy link
Contributor

dbu commented Aug 2, 2014

this fails on travis for nginx (maybe your local php does not treat warnings as errors)

is it ok if we tag beta without this being in? i consider test refactorings to not be a BC break, at least until we document how to use things provided by the bundle for functional tests.

@@ -11,6 +11,8 @@

namespace FOS\HttpCache\Tests;

use FOS\HttpCache\Tests\PHPUnit\IsCacheHitConstraint;
use FOS\HttpCache\Tests\PHPUnit\IsCacheMissConstraint;
Copy link
Contributor

Choose a reason for hiding this comment

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

i have seen the distinction between Test namespace used for base test cases and other things people are supposed to reuse, and Tests for the implementation specific tests stuff that you are not supposed to reuse. don't know how common that is, but if the intention is that people can reuse this, we could use the Test namespace and place things in src/ to make clear its intended to be reused.

@ddeboer
Copy link
Member Author

ddeboer commented Aug 3, 2014

Yeah, this is still failing because I’m working on Varnish first, then Nginx.

);

if (0 !== $returnVar) {
self::markTestSkipped(new \Exception());
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 left-over from development, so should be removed. It does raise the question what we want to happen if someone runs phpunit on the lib when Varnish and/or Nginx is not installed. Should we throw errors, or allow for Varnish-only development too (for instance), and skip the Nginx tests?

Copy link
Contributor

Choose a reason for hiding this comment

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

i think failing loudly is better than just skip in this case. developpers of the cache client lib should see what they do. they can still run only parts of the tests if they really want. or create a custom phpunit.xml file.

for people using the test cases in their own setup, it could be quite bad if launch errors are not properly reported.

Copy link
Member Author

Choose a reason for hiding this comment

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

You’re right. I’m reverting this.

}

/**
* Stop the proxy server
Copy link
Member Author

Choose a reason for hiding this comment

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

Replace with inheritdoc.

Don't skip tests if Nginx is unavailable

Refactor tests

* Refactor tests so they use the new TestCases
* Add PHPDocs
* Update docs
Fix Nginx command-line syntax

Fix Nginx port

Rename getNginx() to getProxyClient()

Fix tests on Nginx

rm -rf * didn’t work correctly because of how ProcessBuilder escapes arguments.

Clean up

Add FOS headers
@ddeboer ddeboer changed the title [WIP] Extract test functionality Extract test functionality Aug 5, 2014
*/
protected $nginx;

const CACHE_EXPIRED = 'EXPIRED';
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 was unused.

@ddeboer
Copy link
Member Author

ddeboer commented Aug 5, 2014

Squashed. This is almost done. @dbu One or two last questions, please have a look.

@@ -44,9 +45,39 @@
/**
* @var Varnish
*/
protected $varnish;
protected $proxyClient;
Copy link
Contributor

Choose a reason for hiding this comment

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

do you repeat this from the base class?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, no, $proxyClient is not in the base class. I just have in separately in Varnish|NginxTestCase to typehint a bit more specifically than ProxyInterface.

@ddeboer
Copy link
Member Author

ddeboer commented Aug 5, 2014

@FriendsOfSymfony/foshttpcache Please merge if you agree with everything here.

By the way, created the foshttpcache team for easy mentions, not such much for us as for other people creating issues and PRs.

dbu added a commit that referenced this pull request Aug 5, 2014
@dbu dbu merged commit e692086 into master Aug 5, 2014
@dbu dbu deleted the extract-test-functionality branch August 5, 2014 08:35
@dbu
Copy link
Contributor

dbu commented Aug 5, 2014

nice, thanks!

we might revisit the documentation to explain more, at some point.

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.

Extract functionality from VarnishTestCase
2 participants