Download the PHP package vu/zf2-test-extensions without Composer
On this page you can find all versions of the php package vu/zf2-test-extensions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vu/zf2-test-extensions
More information about vu/zf2-test-extensions
Files in vu/zf2-test-extensions
Package zf2-test-extensions
Short Description Makes testing controllers and services easier in Zf2
License BSD-3-Clause
Informations about the package zf2-test-extensions
vu/zf2-test-extensions
Introduction
vu/zf2-test-extensions enables easier testing of our Zf2 controllers and services. Most code contained within this project is specifically for use with VeteransUnited Zf2 projects, however is open for anyone to use.
Installation Using Composer
Add "vu/zf2-test-extensions" to the require section of your composer.json file and run a respective install or update. For more information on Composer, please visit their website.
Controllers
The abstract controllers in vu/zf2-test-extensions help ensure that controllers are fully and easily tested. This is done by mocking out the ServiceManager, Request, and Response objects upon test creation.
Action Controllers
The AbstractActionController is what should be used in place of the ActionController from Zf2. This controller will extend the Zf2 ActionController while adding in the benefits of being easier to test.
Restful Controllers
The AbstractRestfulController is what should be used in place of the AbstractRestfulController from Zf2. This controller will extend the Zf2 AbstractRestfulController while adding in the benefits of being easier to test.
Testing Controllers
When testing your controllers, you will want to extend the respective test controller on your test class. This way you can get full benefit out of the library. The extended class will set up the class you're testing and inject an instance of the ServiceLocator. Note that all test classes must implement the getControllerName() method.
Action Controllers
When testing a controller extending the AbstractActionController, you will want your test class to extend AbstractActionControllerTest. Example:
Restful Controllers
When testing a controller extending the AbstractRestfulController, you will want your test class to extend AbstractRestfulControllerTest. Example:
Services
Service Locator
The provided AbstractServiceLocatorAwareService helps by automatically injecting the Zf2 ServiceLocator into your class. Classes that will be loaded via the ServiceLocator should extend this class.
Testing Services
Service Locator
The AbstractServiceLocatorAwareServiceTest sets up the service being tested and injects an instance of the ServiceLocator for you. This should be used to test all classes that extend AbstractServiceLocatorAwareService. Note that all test classes using AbstractServiceLocatorAwareServiceTest must implement the getClassName() method
All versions of zf2-test-extensions with dependencies
zendframework/zend-servicemanager Version >=2.2
zendframework/zend-mvc Version >=2.2