forked from rebing/laravel-soccerama
-
Notifications
You must be signed in to change notification settings - Fork 27
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 #8 from renesoaresse/feature/markets
Implementation of the markets route
- Loading branch information
Showing
3 changed files
with
67 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Sportmonks\SoccerAPI\Requests; | ||
|
||
use Sportmonks\SoccerAPI\SoccerAPIClient; | ||
|
||
class Markets extends SoccerAPIClient { | ||
|
||
public function all() | ||
{ | ||
return $this->callData('markets'); | ||
} | ||
|
||
public function byId($marketsId) | ||
{ | ||
return $this->call('markets/' . $marketsId); | ||
} | ||
|
||
} |
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,42 @@ | ||
<?php | ||
use Sportmonks\SoccerAPI\Facades\SoccerAPI; | ||
|
||
|
||
/** | ||
* @group bookmaker | ||
*/ | ||
class MarketsTest extends TestCase { | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_retrieves_all_markets() | ||
{ | ||
$response = SoccerAPI::markets()->all(); | ||
|
||
$this->assertNotEmpty($response->data); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_retrieves_markets_without_data() | ||
{ | ||
Config::set('soccerapi.without_data', true); | ||
$response = SoccerAPI::markets()->all(); | ||
|
||
$this->assertArrayHasKey(0, $response); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_retrieves_a_markets_by_id() | ||
{ | ||
$response = SoccerAPI::markets()->byId($this->marketsId); | ||
|
||
$this->assertEquals($this->marketsId, $response->data->id); | ||
$this->assertNotNull($response->data->name); | ||
} | ||
|
||
} |