public function testNotFound() { $sphring = new Sphring(__DIR__ . '/../../../sphring/main.yml'); $sphring->loadContext(); $microWebFrameWork = $sphring->getBean('microwebframe.main'); $dispatcher = $microWebFrameWork->getRouter()->getDispatcher(); $request = Request::createFromGlobals(); $response = $dispatcher->dispatch($request->getMethod(), "/404"); $this->assertInstanceOf(Response::class, $response); $this->assertEquals(404, $response->getStatusCode()); }
/** * @param $beanId * @return object */ public function getBean($beanId) { return $this->sphring->getBean($beanId); }
protected function setUp() { file_put_contents(__DIR__ . '/Resources/Sphring/db.ct', 0); $sphring = new Sphring(__DIR__ . '/Resources/Sphring/main.yml'); $sphring->setRootProject(__DIR__ . '/../../..'); $sphring->setComposerLockFile(__DIR__ . '/../../../composer.lock'); $sphring->loadContext(); $this->sphring = $sphring; $_SERVER['HTTP_X_Broker_API_Version'] = '2.4'; $_SERVER['PHP_AUTH_USER'] = '******'; $_SERVER['PHP_AUTH_PW'] = 'changePassw0rd'; $this->microWebFrameWork = $sphring->getBean('microwebframe.main'); $this->dispatcher = $this->microWebFrameWork->getRouter()->getDispatcher(); $doctrineBoot = $this->sphring->getBean('microwebframe.doctrine'); $this->entityManager = $doctrineBoot->getEntityManager(); }