public function testClient() { $client = new Client(Client::BASE_URL_NA); $this->assertEquals($client->getBaseUrl(), Client::BASE_URL_NA); $client->setBaseUrl(Client::BASE_URL_JP); $this->assertEquals($client->getBaseUrl(), Client::BASE_URL_JP); }
public function testResponse() { $testId = 318035; // Rafah Qadriyah Diabolos $client = new Client(Client::BASE_URL_NA); $request = new CharacterRequest($testId); $response = $client->send($request); $this->assertInstanceOf('\\Spliced\\Lodestone\\Response\\CharacterResponse', $response); $this->assertInstanceOf('\\Spliced\\Lodestone\\Model\\Character', $response->getResults()); $character = $response->getResults(); $this->assertInstanceOf('\\Spliced\\Lodestone\\Model\\CharacterAttributes', $character->getAttributes()); $this->assertEquals($character->getId(), $testId); foreach ($character->getMinions() as $minion) { $this->assertInstanceOf('\\Spliced\\Lodestone\\Model\\Minion', $minion); $this->assertNotNull($minion->getName()); $this->assertNotNull($minion->getThumbnail()); } foreach ($character->getMounts() as $mount) { $this->assertInstanceOf('\\Spliced\\Lodestone\\Model\\Mount', $mount); $this->assertNotNull($mount->getName()); $this->assertNotNull($mount->getThumbnail()); } $this->assertInstanceOf('\\Spliced\\Lodestone\\Model\\CharacterClasses', $character->getClasses()); $characterClasses = $character->getClasses(); foreach ($characterClasses->getClasses() as $className => $characterClass) { $this->assertInstanceOf('\\Spliced\\Lodestone\\Model\\CharacterClass', $characterClass); } $characterEquipment = $character->getEquipment(); $this->assertInstanceOf('\\Spliced\\Lodestone\\Model\\CharacterEquipment', $characterEquipment); //foreach($characterEquipment->get) file_put_contents('C:/users/gassan/desktop/test.txt', print_r((array) $character, true)); }
public function testResponse() { $testId = '9232097761132837659'; $client = new Client(Client::BASE_URL_NA); $request = new FreeCompanyMemberListRequest($testId); $response = $client->send($request); file_put_contents('D:\\Projects\\LodestoneAPI\\test.sphp', print_r((array) $response, true)); }
public function testResponse() { $client = new Client(Client::BASE_URL_NA); $request = new CharacterSearchRequest('Rafah Qadriyah'); $request->setOrder(CharacterSearchRequest::ORDER_NAME_DESC)->setPerPage(50)->setPage(1)->setClass(ClassJob::BLACK_MAGE)->setWorld(World::DIABOLOS)->setGrandCompanies(array(GrandCompany::ORDER_OF_THE_TWIN_ADDER))->setLanguages(array(Language::EN)); $response = $client->send($request); $this->assertInstanceOf('\\Spliced\\Lodestone\\Response\\CharacterSearchResponse', $response); $this->assertEquals($response->getTotalResults(), 1); $this->assertEquals($response->getPage(), 1); foreach ($response->getResults() as $characterSearchResult) { $this->assertInstanceOf('\\Spliced\\Lodestone\\Model\\CharacterSearchResult', $characterSearchResult); $this->assertEquals($characterSearchResult->getName(), 'Rafah Qadriyah'); $this->assertNotNull($characterSearchResult->getWorld()); $this->assertNotNull($characterSearchResult->getLanguages()); $this->assertNotNull($characterSearchResult->getThumbnail()); $this->assertNotNull($characterSearchResult->getId()); } }