Skip to content

Decoder and ContentLength plugin #9

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 4 commits into from
Nov 18, 2015
Merged

Conversation

joelwurtz
Copy link
Member

Decoder plugin allows to decode gzip, deflate, compress or chunked body from the response
ContentLengthPlugin "sanitize" the content length header, by setting its value if possible, and if not, (like we are streaming from a process), decorate the body with a chunkstream (so it's compliant with the RFC where no content length header is set)

@@ -19,7 +19,7 @@ env:

matrix:
allow_failures:
- php: 7.0
- php: hhvm
Copy link
Contributor

Choose a reason for hiding this comment

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

i would rather skip those tests on hhvm. and have the plugin throw an exception in the constructor if it is incompatible with hhvm

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm more in the thinking of providing no support for hhvm, i really dont know anyone who is using it, and with upcoming php7 it may be even worse.
IMO I don't want to pass too many hours supporting something not used at all (and rather use them to write more things for php-http :) ).

Copy link
Member

Choose a reason for hiding this comment

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

I would say HHVM is not a top priority for now, but it would be nice to support it eventually.

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 no worries making the tests skip things around streams + hhvm. but i would like to keep the hhvm build green. at liip we do use it in some projects, for example. skipping tests should not be a big hassle. if we end up with most things not working on hhvm, we can reconsider.

@dbu
Copy link
Contributor

dbu commented Nov 13, 2015

this is really cool! do clients like guzzle re-implement all that inside their code? on the other hand, what will guzzle do itself in the end? not much?

@joelwurtz
Copy link
Member Author

Guzzle doesn't implement this, but i think curl does (only for the transfer encoding header if my memory is good)

@joelwurtz
Copy link
Member Author

Will work on hhvm implementation, aside from this, any other remarks ? or is this good to merge ?

@sagikazarmark
Copy link
Member

I haven't really followed this thread, so ask @dbu for any remarks. 👍 from me, awesome work @joelwurtz as usual.

@dbu
Copy link
Contributor

dbu commented Nov 16, 2015

looks good to me. i suggest that you simply add something to the tests to skip. if it would be phpunit, it would be

public function setUp()
{
     if (defined('HHVM_VERSION')) {
         $this->markTestSkipped();
    }
}

@sagikazarmark
Copy link
Member

IIRC Akeneo has a SkipExtension for PHPSpec.

@dbu
Copy link
Contributor

dbu commented Nov 16, 2015 via email

@sagikazarmark
Copy link
Member

if its too much hassle

AFAIK it uses the same logic/annotations as phpunit does. How is it too much hassle?

However I checked it and it can only check existing classes/interfaces, not the PHP env.

@dbu
Copy link
Contributor

dbu commented Nov 16, 2015

However I checked it and it can only check existing classes/interfaces, not the PHP env.

thats what i meant with too much hassle. if we need to find some phpspec plugins and whatnot, we can just as well do it from .travis.yml. as we agree hhvm is not top priority, we should have a simple way to skip those tests.

@sagikazarmark
Copy link
Member

I would still stick to the setUp/let method instead of some weird rm logic. 😜

@sagikazarmark
Copy link
Member

use PhpSpec\Exception\Example\SkippingException;
//...
function let()
{
    if(defined('HHVM_VERSION')) {
        throw new SkippingException();
    }
}

@dbu
Copy link
Contributor

dbu commented Nov 16, 2015 via email

@sagikazarmark
Copy link
Member

Because tests are called "examples" in phpspec terminology:

  • There are Suites which are collections of tests (for example you have one spec/ directory)
  • There are Specifications which are collections of examples (one class, several test methods)
  • There are Examples which are the actual test methods (eg. it_does_something)

@joelwurtz joelwurtz force-pushed the feature/decoder-encoder-plugin branch from 7ebc921 to adc87e0 Compare November 16, 2015 22:01
@joelwurtz
Copy link
Member Author

Ok on hhvm, ready to merge ?

@joelwurtz joelwurtz force-pushed the feature/decoder-encoder-plugin branch from e8948f3 to 3a606b9 Compare November 18, 2015 00:49
@dbu
Copy link
Contributor

dbu commented Nov 18, 2015

great. can you please move hhvm out of the allowed to fail tests again? then we are good to merge.

we have to remember to mention in the plugin doc that the encoding plugin does not support hhvm.

@dbu
Copy link
Contributor

dbu commented Nov 18, 2015

actually, maybe you can mark the stream library as conflicting with hhvm? we have no hard dependencies on the libraries used by the plugins, so people trying to run this will notice there is a problem even if they don't read the documentation.

@sagikazarmark
Copy link
Member

Conflict means uninstallable, right?

@dbu
Copy link
Contributor

dbu commented Nov 18, 2015 via email

@joelwurtz
Copy link
Member Author

test will failed then on hhvm for this, as we require this lib in dev packages, any way of avoiding that ?

@dbu
Copy link
Contributor

dbu commented Nov 18, 2015

oh well. i guess that won't work. lets leave it like this then. just move hhvm out of allowed failures and then we merge this.

we could remove it from require-dev and have travis run composer require if not on hhvm, but that is complicated. i guess hhvm users are used to having to check whether libraries work on hhvm...

@joelwurtz
Copy link
Member Author

Encoding library can work on hhvm, just requiring implementing many filters from the php world :/

joelwurtz added a commit that referenced this pull request Nov 18, 2015
@joelwurtz joelwurtz merged commit 821e8a3 into master Nov 18, 2015
@joelwurtz joelwurtz deleted the feature/decoder-encoder-plugin branch November 18, 2015 10:38
@dbu
Copy link
Contributor

dbu commented Nov 18, 2015 via email

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.

3 participants