protected function setUp() { $factory = new Factory(); $this->repository = new SchemasRepository($factory); $this->repository->configure($this->config); $defaults = $this->config[SchemasRepository::DEFAULTS]; $this->defaults = $factory->createContainer($defaults); $this->a = $factory->createContainer(array_merge($defaults, $this->config[static::A])); $this->b = $factory->createContainer(array_merge($defaults, $this->config[static::B])); }
protected function setUp() { $factory = new Factory(); $urlPrefix = 'https://www.example.tld/api/v1'; $schemas = $factory->createContainer(['Author' => 'AuthorSchema']); $this->encoderA = $factory->createEncoder($schemas, new EncoderOptions(0, $urlPrefix)); $this->encoderB = $factory->createEncoder($schemas, new EncoderOptions(JSON_BIGINT_AS_STRING, $urlPrefix)); $this->encoderC = $factory->createEncoder($schemas, new EncoderOptions(JSON_PRETTY_PRINT, $urlPrefix, 123)); $this->decoderA = new DocumentDecoder(); $this->decoderB = new ArrayDecoder(); $this->repository = new CodecMatcherRepository($factory); $this->repository->registerSchemas($schemas)->registerUrlPrefix($urlPrefix); $this->repository->configure($this->config); }
/** * @return void */ protected function setUp() { $store = new Store(); $factory = new Factory(); $this->codecMatcher = $factory->createCodecMatcher(); $this->interpreter = $this->getMockForAbstractClass(AbstractRequestInterpreter::class); $this->adapter = $this->getMock(AdapterInterface::class); $this->adapter->method('recognises')->with('posts')->willReturn(true); $store->register($this->adapter); $this->api = new Api('v1', $this->interpreter, $this->codecMatcher, $factory->createContainer(), $store); $this->requestFactory = new RequestFactory(); $this->withMediaType(); }