You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.3 KiB
56 lines
1.3 KiB
<?php
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
use Database\Connection;
|
|
|
|
class AthleteGatewayTest extends TestCase {
|
|
|
|
public function testAddAndGetAthlete() {
|
|
|
|
$dsn = "pgsql:host=londres;port=8888;dbname=dbkemonteiro2;user=kemonteiro2;password=Mdp";
|
|
|
|
$connection = new Connection($dsn);
|
|
|
|
|
|
$athleteGateway = new AthleteGateway($connection);
|
|
|
|
|
|
$athleteEntity = new AthleteEntity();
|
|
$athleteEntity->setNom('John');
|
|
$athleteEntity->setPrenom('Doe');
|
|
$athleteEntity->setIdAthlete(1234);
|
|
$athleteEntity->setEmail('kevin.monteiro@gmail.fr');
|
|
$athleteEntity->setSexe('H');
|
|
$athleteEntity->setTaille(169);
|
|
$athleteEntity->setPoids(69);
|
|
$athleteEntity->setMotDePasse('motdepasse');
|
|
$athleteEntity->setDateNaissance('26/03/2004');
|
|
|
|
//$result = $athleteGateway->addAthlete($athleteEntity);
|
|
|
|
|
|
//$this->assertTrue($result);
|
|
|
|
|
|
$athleteId = $athleteEntity->getIdAthlete();
|
|
$retrievedAthlete = $athleteGateway->getAthleteById($athleteId);
|
|
|
|
|
|
$this->assertInstanceOf(AthleteEntity::class, $retrievedAthlete);
|
|
|
|
|
|
$this->assertEquals('John', $retrievedAthlete->getNom());
|
|
$this->assertEquals('Doe', $retrievedAthlete->getPrenom());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|