/** * Validate and merge array of connection settings * and filters for request. * * @param array $filters Array of filters * * @return array */ protected function mergeFilter(array &$filters) { $filters['api_key'] = $this->keys->retrieve(static::SOURCE_TYPE)->getToken(); $validFilters = new Rules\OneOf(new Rules\Instance(SI::class), new Rules\AllOf(new Rules\ArrayType(), new Rules\NotEmpty())); if ($validFilters->validate($this->options) === true) { return $this->options + ['query' => $filters]; } return ['query' => $filters]; }
/** * Create the valid container for tokens * using built-in container methods. * * @test */ public function createTokensFromContainer() { $marvel = new Token($this->marvelTok, 'marvel'); $comicvine = new Token($this->comicVineTok, 'comicvine'); $container = new TokenContainer(); $container->createAndStore($this->marvelTok, "marvel")->createAndStore($this->comicVineTok, "comicvine"); $this->assertTrue($container->isValid()); $this->assertEquals($marvel, $container->retrieve('marvel')); $this->assertEquals($comicvine, $container->retrieve('comicvine')); }