/** * Gets first client by default. */ public function getClient($id = null) { if ($id === null) { list($id, $dummy) = each($this->getClients()); } return parent::getClient($id); }
/** * @depends testGetProviderById */ public function testCreateProvider() { $collection = new Collection(); $clientId = 'testClientId'; $clientClassName = TestClient::className(); $clients = [$clientId => ['class' => $clientClassName]]; $collection->setClients($clients); $provider = $collection->getClient($clientId); $this->assertTrue(is_object($provider), 'Unable to create client by config!'); $this->assertTrue(is_a($provider, $clientClassName), 'Client has wrong class name!'); }