Repository navigation
Photon: Do not image_downsize for REST API requests in the edit context - #10592
Conversation
|
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: December 4, 2018. Generated by 🚫 dangerJS |
This reverts commit 083e918.
…/v2/media endpoint in the edit context
|
Based on the docs, it should be an instance of the class checked as populated by the $endpoints property of the class. I need to hand this one off for testing and getting across the finish line. Thanks for your work on this! |
We're not checking for the right value. Also, in theory, `$handler` could be any callable.
…ng `?context=edit` REST requests. Fix some PHPDoc.
Clean the `Jetpack_Photon` state before each test. The singleton/static class property make it annoying to clean the state.
jeherve
left a comment
There was a problem hiding this comment.
PHP 5.2 is causing us some issues here :(
| // static variable. | ||
| // l337 h4X0Ring required: | ||
| $instance = new ReflectionProperty( 'Jetpack_Photon', '__instance' ); | ||
| $instance->setAccessible( true ); |
There was a problem hiding this comment.
This makes our PHP 5.2 tests trip:
Fatal error: Call to undefined method ReflectionProperty::setAccessible() in wp-content/plugins/jetpack/tests/php/test_class.jetpack_photon.php on line 35
There was a problem hiding this comment.
That's sad :(
http://php.net/manual/en/reflectionproperty.setaccessible.php PHP 5.3+
I'm not sure what to do here, then. We're only using that code to make the Jetpack_Publicize class testable - not to implement any functionality.
We could skip the tests for PHP 5.2, but that seems sketchy.
There was a problem hiding this comment.
I am afraid the tests are still failing :( Travis won't let us merge that one.
There was a problem hiding this comment.
OK - I'll look into it more later. Thanks for the ping!
The singleton/static class property make it annoying to test, and is only possible in PHP 5.3+ http://php.net/manual/en/reflectionproperty.setaccessible.php
The version of PHPUnit we're running on TravisCI is very old and doesn't support `@requires`.
jeherve
left a comment
There was a problem hiding this comment.
It seems to work well in my tests. 🚢
…xt (#10592) Photon: Do image_downsize for REST API requests on the wp/v2/media endpoint in the edit context. For tests, we need to clean the `Jetpack_Photon` state before each test, which is annoying because of the singleton/static class property. Unfortunately, the tests are not compatible with PHP 5.3, though the feature is.
|
Cherry-picked to |
Fixes #10580
Changes proposed in this Pull Request:
Testing instructions:
Proposed changelog entry for your changes: