private function createConfiguration($headerName, array $priorities = ['']) { $conf = new Configuration(); $conf->setHeaderName($headerName); $conf->setPriorities($priorities); return $conf; }
/** * Create an instance of Configuration. * * @param $headerName string name of accept header * @param $priorities array[string] list of accepted values sorted by * priority (first has highest) * @return Configuration */ public function create($headerName, array $priorities) { $negotiator = $this->createNegotiator($headerName); $acceptFactory = $this->createAcceptFactory($headerName); $c = new Configuration(); $c->setHeaderName($headerName); $c->setPriorities($priorities); $c->setNegotiator($negotiator); $c->setAcceptFactory($acceptFactory); return $c; }
function testGetters() { $headerName = 'the name'; $negotiator = new LanguageNegotiator(); $priorities = ['one', 'two']; $acceptFactory = function () { }; $c = new Configuration(); $c->setHeaderName($headerName); $c->setPriorities($priorities); $c->setNegotiator($negotiator); $c->setAcceptFactory($acceptFactory); $this->assertSame($headerName, $c->getHeaderName()); $this->assertSame($negotiator, $c->getNegotiator()); $this->assertSame($priorities, $c->getPriorities()); }