Ejemplo n.º 1
0
 /**
  * @test
  * @dataProvider provideQuestData
  */
 public function GetQuest($questId)
 {
     $client = new WowApi(array('region' => 'us', 'httpAdapter' => 'curl'));
     $result = $client->getQuest($questId);
     $this->assertObjectHasAttribute('title', $result);
 }
Ejemplo n.º 2
0
<?php

// Autoloading
use BattleNet\Api\Wow\Call\Data\ItemCall;
use Symfony\Component\ClassLoader\UniversalClassLoader;
use BattleNet\Api\Wow\WowApi;
require_once __DIR__ . '/vendor/symfony/lib/Symfony/Component/ClassLoader/UniversalClassLoader.php';
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array('BattleNet' => __DIR__ . '/lib'));
$loader->register();
$wowApi = new WowApi(array('region' => 'eu', 'locale' => 'en_GB'));
// Getting character as standard php class
$khepri = $wowApi->getCharacter('Kilrogg', 'khepri');
echo "realm: " . $khepri->realm . "\n";
echo "name: " . $khepri->name . "\n";
echo "level: " . $khepri->level . "\n";
// Getting character as array
$cagalli = $wowApi->getCharacter('Kilrogg', 'Cagalli', array('achievements'), true);
echo "realm: " . $cagalli['realm'] . "\n";
echo "name: " . $cagalli['name'] . "\n";
echo "level: " . $cagalli['level'] . "\n";
echo "achievements Completed: " . count($cagalli['achievements']['achievementsCompleted']) . "\n";
// Getting realm status
$realms = $wowApi->getRealmStatus('Kilrogg');
var_dump($realms->realms[0]);
try {
    $characterCall = new ItemCall(1000);
    $response = $wowApi->request($characterCall);
    var_dump($response);
} catch (Exception $e) {
    var_dump($e->getMessage());
Ejemplo n.º 3
0
 /**
  * @test
  * @expectedException BattleNet\Api\Exception\NotFoundException
  * @expectedExceptionMessage Not Found
  */
 public function GetNonexistingCharacter()
 {
     $client = new WowApi(array('region' => 'eu', 'locale' => 'en_GB', 'httpAdapter' => 'fallback'));
     $result = $client->getCharacter('Kilrogg', 'DoesNotExists');
 }