protected function getCubex() { $cubex = new Cubex(); $cubex->prepareCubex(); $cubex->processConfiguration($cubex->getConfiguration()); return $cubex; }
public function getKernel($defaultAction = 'abc') { $cubex = new Cubex(); $cubex->prepareCubex(); $cubex->processConfiguration($cubex->getConfiguration()); $kernel = new SubDomainTester(); $kernel->setDefaultResponse($defaultAction); $kernel->setCubex($cubex); return $kernel; }
/** * @param $uri * @param $route * * @dataProvider baseRoutesProvider * * @link https://github.com/cubex/framework/issues/2 */ public function testBaseRoutes($uri, $route) { $request = Request::createFromGlobals(); $request->server->set('REQUEST_URI', $uri); $cubex = new Cubex(); $cubex->prepareCubex(); $cubex->processConfiguration($cubex->getConfiguration()); /** * @var CubexKernel|\PHPUnit_Framework_MockObject_MockObject $kernel */ $kernel = $this->getMock('\\Cubex\\Kernel\\CubexKernel', ['getRoutes', 'resp']); $kernel->expects($this->any())->method("getRoutes")->will($this->returnValue([$route => 'resp'])); $kernel->expects($this->any())->method("resp")->will($this->returnValue("respdata")); $kernel->setCubex($cubex); $resp = $kernel->handle($request, Cubex::MASTER_REQUEST, false); $this->assertInstanceOf('\\Symfony\\Component\\HttpFoundation\\Response', $resp); $this->assertEquals("respdata", $resp->getContent()); }