Last active
August 29, 2015 14:23
-
-
Save stefanotorresi/1efd762fd1ad05f70559 to your computer and use it in GitHub Desktop.
Functional test on a ZF2 application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Zend\Test\PHPUnit\Controller\AbstractControllerTestCase as TestCase; | |
abstract class AbstractFunctionalTestCase extends TestCase | |
{ | |
public function setUp() | |
{ | |
// assumes cwd is project root | |
$config = include 'config/application.config.php'; | |
$config['config_cache_enabled'] = false; | |
// loads *test.php files from `config/autoload` | |
$config['module_listener_options']['config_glob_paths'] = [ | |
'config/autoload/{,*.}{global,test}.php', | |
]; | |
$this->setApplicationConfig($config); | |
parent::setUp(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SomeServiceFunctionalTest extends AbstractFunctionalTestCase | |
{ | |
public fucntion testFunctionalDI() | |
{ | |
$dependency = $this->getApplicationServiceLocator()->get('ConcreteDependency'); | |
$someService = new SomeService($dependency); | |
// run assertions on $someService; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment