-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from GW2Treasures/endpoints/wvw-objectives
Add /v2/wvw/objectives endpoint
- Loading branch information
Showing
5 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace GW2Treasures\GW2Api\V2\Endpoint\WvW; | ||
|
||
use GW2Treasures\GW2Api\V2\Bulk\BulkEndpoint; | ||
use GW2Treasures\GW2Api\V2\Bulk\IBulkEndpoint; | ||
use GW2Treasures\GW2Api\V2\Endpoint; | ||
use GW2Treasures\GW2Api\V2\Localization\ILocalizedEndpoint; | ||
use GW2Treasures\GW2Api\V2\Localization\LocalizedEndpoint; | ||
|
||
class ObjectiveEndpoint extends Endpoint implements IBulkEndpoint, ILocalizedEndpoint { | ||
use BulkEndpoint, LocalizedEndpoint; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function url() { | ||
return 'v2/wvw/objectives'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace GW2Treasures\GW2Api\V2\Endpoint\WvW; | ||
|
||
use GW2Treasures\GW2Api\V2\Endpoint; | ||
|
||
class WvWEndpoint extends Endpoint { | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function url() { | ||
return 'v2/wvw'; | ||
} | ||
|
||
public function objectives() { | ||
return new ObjectiveEndpoint( $this->api ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
class WvWEndpointTest extends TestCase { | ||
public function test() { | ||
$endpoint = $this->api()->wvw(); | ||
|
||
$this->assertEndpointUrl( 'v2/wvw', $endpoint ); | ||
} | ||
|
||
public function testObjectiveEndpoint() { | ||
$endpoint = $this->api()->wvw()->objectives(); | ||
|
||
$this->assertEndpointIsBulk( $endpoint ); | ||
$this->assertEndpointIsLocalized( $endpoint ); | ||
$this->assertEndpointUrl( 'v2/wvw/objectives', $endpoint ); | ||
|
||
$this->mockResponse('{"id": "968-98","name": "Wurm Tunnel"}'); | ||
$this->assertEquals( 'Wurm Tunnel', $endpoint->get('968-98')->name ); | ||
} | ||
} |