public static function getDevConfig() { $config = new Config(); $config->load(self::rootPath() . 'src/BackbonePhp/Application/config/permissions.json'); $config->load(self::rootPath() . 'src/BackbonePhp/Application/config/groups.json'); $config->load(self::rootPath() . 'src/BackbonePhp/Application/config/models.json'); $config->load(self::rootPath() . 'src/BackbonePhp/Application/config/application.json'); $config->load(self::fixturesPath() . 'dev-config.json'); return $config; }
public function it_generates_a_frontend_config_object() { $config = new Config(); $config->load(SpecHelper::rootPath() . 'src/BackbonePhp/Application/config/application.json'); $config->load(SpecHelper::rootPath() . 'src/BackbonePhp/Application/config/groups.json'); $config->load(SpecHelper::rootPath() . 'src/BackbonePhp/Application/config/models.json'); $config->load(SpecHelper::rootPath() . 'src/BackbonePhp/Application/config/permissions.json'); $this->config = $config; $request = new Request(); $response = new Response(); $route = (object) []; $this->handleFrontendConfigRequest($request, $response, $route)->shouldReturn($this); Assertions::assertEquals('application/json', $response->getHeader('Content-Type'), 'should set content type to JSON'); Assertions::assertEquals('BackbonePHP', $response->getBody()->appName, 'should set status field'); Assertions::assertFalse(isset($response->getBody()->groups), 'should net expose user groups'); Assertions::assertFalse(isset($response->getBody()->permissions), 'should net expose permissions'); }
public function it_generates_a_status_object() { $config = new Config(); $config->load(SpecHelper::rootPath() . 'src/BackbonePhp/Application/config/models.json'); $this->config = $config; $request = new Request(); $response = new Response(); $route = (object) []; $this->handleStatusRequest($request, $response, $route)->shouldReturn($this); Assertions::assertEquals('application/json', $response->getHeader('Content-Type'), 'should set content type to JSON'); Assertions::assertEquals('ok', $response->getBody()->status, 'should set status field'); Assertions::assertTrue(is_int($response->getBody()->timestamp), 'should set timestamp field'); }
protected function setConfig() { $config = new Config(); $config->load(SpecHelper::fixturesPath() . 'dev-config.json'); $this->config = $config; }