-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5bc6dd
commit 5b39a6b
Showing
15 changed files
with
300 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
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,104 @@ | ||
<?php | ||
|
||
namespace App\Tests; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||
|
||
class PlayerControllerTest extends WebTestCase | ||
{ | ||
protected function getBaseURL() { | ||
return 'http://soccerManagement.local'; | ||
} | ||
|
||
public function testPlayer() | ||
{ | ||
$client = new \GuzzleHttp\Client([ | ||
'base_url' => $this->getBaseURL(), | ||
'defaults' => [ | ||
'exceptions' => false | ||
] | ||
]); | ||
|
||
$data = array( | ||
"firstName"=> "Hancil q", | ||
"lastName" => "Sequeira", | ||
"playerImageURI"=>"http:://abc.jpeg" | ||
); | ||
|
||
$response = $client->get('/api/player', [ | ||
'body' => json_encode($data) | ||
]); | ||
|
||
$this->assertEquals(200, $response->getStatusCode()); | ||
$finishedData = json_decode($response->getBody(true), true); | ||
} | ||
|
||
public function testPutPlayer() | ||
{ | ||
$client = new \GuzzleHttp\Client([ | ||
'base_url' => $this->getBaseURL(), | ||
'defaults' => [ | ||
'exceptions' => false | ||
] | ||
]); | ||
|
||
$data = array( | ||
"firstName"=> "Hancil q", | ||
"lastName" => "Sequeira", | ||
"playerImageURI"=>"http:://abc.jpeg" | ||
); | ||
|
||
$response = $client->get('/api/player?id=3', [ | ||
'body' => json_encode($data) | ||
]); | ||
|
||
$this->assertEquals(200, $response->getStatusCode()); | ||
$finishedData = json_decode($response->getBody(true), true); | ||
} | ||
|
||
public function testDeletePlayer() | ||
{ | ||
$client = new \GuzzleHttp\Client([ | ||
'base_url' => $this->getBaseURL(), | ||
'defaults' => [ | ||
'exceptions' => false | ||
] | ||
]); | ||
|
||
|
||
$response = $client->get('/api/player?playerId=3'); | ||
|
||
$this->assertEquals(200, $response->getStatusCode()); | ||
$finishedData = json_decode($response->getBody(true), true); | ||
} | ||
|
||
public function testPlayerById() | ||
{ | ||
$client = new \GuzzleHttp\Client([ | ||
'base_url' => $this->getBaseURL(), | ||
'defaults' => [ | ||
'exceptions' => false | ||
] | ||
]); | ||
|
||
$response = $client->get('/api/player/3'); | ||
|
||
$this->assertEquals(200, $response->getStatusCode()); | ||
$finishedData = json_decode($response->getBody(true), true); | ||
} | ||
|
||
public function testPlayerListBasedOnIdOrNameAction() | ||
{ | ||
$client = new \GuzzleHttp\Client([ | ||
'base_url' => $this->getBaseURL(), | ||
'defaults' => [ | ||
'exceptions' => false | ||
] | ||
]); | ||
|
||
$response = $client->get('/api/players/2'); | ||
|
||
$this->assertEquals(200, $response->getStatusCode()); | ||
$finishedData = json_decode($response->getBody(true), true); | ||
} | ||
} |
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,106 @@ | ||
<?php | ||
|
||
namespace App\Tests; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||
|
||
class TeamControllerTest extends WebTestCase | ||
{ | ||
protected function getBaseURL() { | ||
return 'http://soccerManagement.local'; | ||
} | ||
|
||
public function testCreateTeam() | ||
{ | ||
$client = new \GuzzleHttp\Client([ | ||
'base_url' => $this->getBaseURL(), | ||
'defaults' => [ | ||
'exceptions' => false | ||
] | ||
]); | ||
|
||
$data = array( | ||
"name"=>"test", | ||
"logoURI=">"http:://abc.jpeg" | ||
); | ||
|
||
$response = $client->get('/api/team',['body' => json_encode($data)]); | ||
|
||
$this->assertEquals(200, $response->getStatusCode()); | ||
$finishedData = json_decode($response->getBody(true), true); | ||
} | ||
|
||
public function testPutTeam() | ||
{ | ||
$client = new \GuzzleHttp\Client([ | ||
'base_url' => $this->getBaseURL(), | ||
'defaults' => [ | ||
'exceptions' => false | ||
] | ||
]); | ||
|
||
$data = array( | ||
"name"=>"test", | ||
"logoURI=">"http:://abc.jpeg" | ||
); | ||
|
||
$response = $client->get('/api/team?id=3', [ | ||
'body' => json_encode($data) | ||
]); | ||
|
||
$this->assertEquals(200, $response->getStatusCode()); | ||
$finishedData = json_decode($response->getBody(true), true); | ||
} | ||
|
||
public function testAddPlayerToTeam() | ||
{ | ||
$client = new \GuzzleHttp\Client([ | ||
'base_url' => $this->getBaseURL(), | ||
'defaults' => [ | ||
'exceptions' => false | ||
] | ||
]); | ||
|
||
$data = array( | ||
"teamId"=>1, | ||
"playerId"=>3 | ||
); | ||
|
||
$response = $client->get('/api/team-players', [ | ||
'body' => json_encode($data) | ||
]); | ||
|
||
$this->assertEquals(200, $response->getStatusCode()); | ||
$finishedData = json_decode($response->getBody(true), true); | ||
} | ||
|
||
public function testTeamListAction() | ||
{ | ||
$client = new \GuzzleHttp\Client([ | ||
'base_url' => $this->getBaseURL(), | ||
'defaults' => [ | ||
'exceptions' => false | ||
] | ||
]); | ||
|
||
$response = $client->get('/api/players'); | ||
|
||
$this->assertEquals(200, $response->getStatusCode()); | ||
$finishedData = json_decode($response->getBody(true), true); | ||
} | ||
|
||
public function testPlayerListBasedOnTeamAction() | ||
{ | ||
$client = new \GuzzleHttp\Client([ | ||
'base_url' => $this->getBaseURL(), | ||
'defaults' => [ | ||
'exceptions' => false | ||
] | ||
]); | ||
|
||
$response = $client->get('/api/players/2'); | ||
|
||
$this->assertEquals(200, $response->getStatusCode()); | ||
$finishedData = json_decode($response->getBody(true), true); | ||
} | ||
} |