/** * @depends testDefaults */ public function testRootConfig() { $defaults = $this->config[SchemasRepository::DEFAULTS]; $repository = new SchemasRepository(new Factory()); $repository->configure($defaults); $this->assertEquals($this->defaults, $repository->getSchemas()); $this->setExpectedException(\RuntimeException::class); $repository->getSchemas('foo'); }
/** * @return void */ protected function setUp() { $this->codecMatchers = new CodecMatcherRepository(); $this->schemas = new SchemasRepository(); $this->store = new Store(); $this->requestInterpreter = $this->getMock(RequestInterpreterInterface::class); $this->httpFactory = new Factory(); $this->factory = new ApiFactory($this->codecMatchers, $this->schemas, $this->store, $this->requestInterpreter, $this->httpFactory); $this->schemas->configure(['defaults' => ['Person' => 'Api\\People\\Schema', 'Post' => 'Api\\Posts\\Schema', 'Comment' => 'Api\\Comments\\Schema'], 'v1' => [], 'v2' => ['Person' => 'Api\\People\\V2\\Schema']]); }