%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.149 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/11584/cwd/html/ppaobm/vendor/codeception/base/src/Codeception/Module/ |
Upload File : |
<?php namespace Codeception\Module; use Codeception\Lib\Framework; use Codeception\TestInterface; use Codeception\Configuration; use Codeception\Lib\Connector\ZendExpressive as ZendExpressiveConnector; use Codeception\Lib\Interfaces\DoctrineProvider; /** * This module allows you to run tests inside Zend Expressive. * * Uses `config/container.php` file by default. * * ## Status * * * Maintainer: **Naktibalda** * * Stability: **alpha** * * ## Config * * * container: relative path to file which returns Container (default: `config/container.php`) * * ## API * * * application - instance of `\Zend\Expressive\Application` * * container - instance of `\Interop\Container\ContainerInterface` * * client - BrowserKit client * */ class ZendExpressive extends Framework implements DoctrineProvider { protected $config = [ 'container' => 'config/container.php', ]; /** * @var \Codeception\Lib\Connector\ZendExpressive */ public $client; /** * @var \Interop\Container\ContainerInterface */ public $container; /** * @var \Zend\Expressive\Application */ public $application; protected $responseCollector; public function _initialize() { $cwd = getcwd(); $projectDir = Configuration::projectDir(); chdir($projectDir); $this->container = require $projectDir . $this->config['container']; $app = $this->container->get('Zend\Expressive\Application'); $pipelineFile = $projectDir . 'config/pipeline.php'; if (file_exists($pipelineFile)) { require $pipelineFile; } $routesFile = $projectDir . 'config/routes.php'; if (file_exists($routesFile)) { require $routesFile; } chdir($cwd); $this->application = $app; $this->initResponseCollector(); } public function _before(TestInterface $test) { $this->client = new ZendExpressiveConnector(); $this->client->setApplication($this->application); $this->client->setResponseCollector($this->responseCollector); } public function _after(TestInterface $test) { //Close the session, if any are open if (session_status() == PHP_SESSION_ACTIVE) { session_write_close(); } parent::_after($test); } private function initResponseCollector() { /** * @var Zend\Expressive\Emitter\EmitterStack */ $emitterStack = $this->application->getEmitter(); while (!$emitterStack->isEmpty()) { $emitterStack->pop(); } $this->responseCollector = new ZendExpressiveConnector\ResponseCollector; $emitterStack->unshift($this->responseCollector); } public function _getEntityManager() { $service = 'Doctrine\ORM\EntityManager'; if (!$this->container->has($service)) { throw new \PHPUnit\Framework\AssertionFailedError("Service $service is not available in container"); } return $this->container->get('Doctrine\ORM\EntityManager'); } }