Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

[WIP] V3 readiness #35

Closed
wants to merge 10 commits into from
Closed

[WIP] V3 readiness #35

wants to merge 10 commits into from

Conversation

mtymek
Copy link
Contributor

@mtymek mtymek commented Feb 9, 2016

This PR prepares zend-view for supporting ServiceManager v3.

  • update repository according to migration/compatibility guide
  • fix failing tests for SMv2
  • fix failing tests for SMv3
  • ensure everything works together after zend-mvc is v3-compatible

Last element is blocked by zendframework/zend-cache#68 - SMv3 cannot be installed at this moment because cache component is not V3-ready.

Edit: zend-cache was fixed, apparently zend-mvc is the blocker now.

]]);
$this->setExpectedException('Zend\ServiceManager\Exception\InvalidServiceException');
$this->setExpectedException('Zend\View\Exception\InvalidHelperException');
Copy link

Choose a reason for hiding this comment

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

This will need to check for a different exception depending on whether it's run under v2 or v3. Easiest way is to call a getInvalidServiceException() method in the same way the CommonPluginManagerTrait does. Or, if it's not a whole load of retooling, use the trait in this test and ditch the compatibility test.

@kynx
Copy link

kynx commented Feb 10, 2016

@mtymek
Copy link
Contributor Author

mtymek commented Feb 11, 2016

I updated the code according to kynx's feedback. I tested it with ServiceManager v3 (by temporarily setting required version as 3.0.3 as 2.8.0), and then I saw only 7 tests failing, apparently all related to zend-mvc being not compatible yet - apparently it is the last blocker.
I will wait until it is ready, and then do the final check.

@weierophinney
Copy link
Member

@mtymek The approach I've been using for dependencies that are in the require-dev section, but which do not yet have forwards-compat releases, is as follows:

  • When testing on travis-ci against servicemanager and/or eventmanager v3, remove the dependency (composer remove --no-update zendframework/zend-such-and-such).
  • Find tests related to the component, and mark them skipped, with a message indicating they should be re-enabled once the component has forwards-compat releases.

This works in most situations, particularly when we start seeing circular dependencies (essentially, any zend-mvc dependency observed is likely a circular dependency at this point).

In this particular component, we have forwards-compat changes for a good portion of the components listed in the require-dev section, and all items in require have stable forwards-compat releases. If the only tests failing currently are due to zend-mvc, we can safely use this approach.

I'm willing to do that work today when merging; zend-view is a dep for a number of other components (navigation and form in particular), so this would help unblock some of those.

@weierophinney weierophinney added this to the 2.6.0 milestone Feb 17, 2016
@weierophinney weierophinney self-assigned this Feb 17, 2016
Helper\EscapeHtml::class => InvokableFactory::class,
'zendviewhelperescapehtml' => InvokableFactory::class,
Copy link
Member

Choose a reason for hiding this comment

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

Separate the FQCN and normalized names, and group them by type. This will allow us to remove the normalized versions more easily at a later date. (I can do this on merge if needed.)

@mtymek
Copy link
Contributor Author

mtymek commented Feb 17, 2016

  • separated FQCN from normalized name
  • switched "Config" to lowercase

@mtymek
Copy link
Contributor Author

mtymek commented Feb 17, 2016

As per your suggestion, I marked some tests as "skipped". Unfortunately I still get some errors in PluginManagerCompatibilityTest under v3, that I'm not able to resolve:

PHP Fatal error:  Class 'Zend\Mvc\Controller\Plugin\FlashMessenger' not found in /home/mat/public_html/zend-view/src/Helper/Service/FlashMessengerFactory.php on line 33
PHP Stack trace:
PHP   1. {main}() /home/mat/public_html/zend-view/vendor/phpunit/phpunit/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /home/mat/public_html/zend-view/vendor/phpunit/phpunit/phpunit:47
PHP   3. PHPUnit_TextUI_Command->run() /home/mat/public_html/zend-view/vendor/phpunit/phpunit/src/TextUI/Command.php:100
PHP   4. PHPUnit_TextUI_TestRunner->doRun() /home/mat/public_html/zend-view/vendor/phpunit/phpunit/src/TextUI/Command.php:149
PHP   5. PHPUnit_Framework_TestSuite->run() /home/mat/public_html/zend-view/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:440
PHP   6. PHPUnit_Framework_TestSuite->run() /home/mat/public_html/zend-view/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
PHP   7. PHPUnit_Framework_TestSuite->run() /home/mat/public_html/zend-view/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
PHP   8. PHPUnit_Framework_TestCase->run() /home/mat/public_html/zend-view/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
PHP   9. PHPUnit_Framework_TestResult->run() /home/mat/public_html/zend-view/vendor/phpunit/phpunit/src/Framework/TestCase.php:724
PHP  10. PHPUnit_Framework_TestCase->runBare() /home/mat/public_html/zend-view/vendor/phpunit/phpunit/src/Framework/TestResult.php:612
PHP  11. PHPUnit_Framework_TestCase->runTest() /home/mat/public_html/zend-view/vendor/phpunit/phpunit/src/Framework/TestCase.php:768
PHP  12. ReflectionMethod->invokeArgs() /home/mat/public_html/zend-view/vendor/phpunit/phpunit/src/Framework/TestCase.php:909
PHP  13. ZendTest\View\PluginManagerCompatibilityTest->testPluginAliasesResolve() /home/mat/public_html/zend-view/vendor/phpunit/phpunit/src/Framework/TestCase.php:909
PHP  14. Zend\ServiceManager\AbstractPluginManager->get() /home/mat/public_html/zend-view/vendor/zendframework/zend-servicemanager/src/Test/CommonPluginManagerTrait.php:75
PHP  15. Zend\ServiceManager\ServiceManager->get() /home/mat/public_html/zend-view/vendor/zendframework/zend-servicemanager/src/AbstractPluginManager.php:143
PHP  16. Zend\ServiceManager\ServiceManager->doCreate() /home/mat/public_html/zend-view/vendor/zendframework/zend-servicemanager/src/ServiceManager.php:196
PHP  17. Zend\View\Helper\Service\FlashMessengerFactory->__invoke() /home/mat/public_html/zend-view/vendor/zendframework/zend-servicemanager/src/ServiceManager.php:700

How can I work around it?

edit: pasted wrong error before...

@weierophinney
Copy link
Member

@mtymek ha! I've already pulled locally to review!

In that particular case, the plugin requires zend-session, which does not have a forwards-compat version yet. As such, I'd override the aliasProvider() method and have it skip that alias; you can see an example of that in the FilterPluginManagerCompatibilityTest.

Since I'm in the process of review anyways, I can do that for you if you'd like.

@mtymek
Copy link
Contributor Author

mtymek commented Feb 17, 2016

OK, please do - I was about to finish for today :-)

weierophinney added a commit to weierophinney/zend-view that referenced this pull request Feb 17, 2016
weierophinney added a commit that referenced this pull request Feb 17, 2016
weierophinney added a commit that referenced this pull request Feb 17, 2016
@weierophinney
Copy link
Member

Merged with #42!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants