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.
Web/Sources/tests/MapperTest.php

43 lines
1.2 KiB

<?php
use PHPUnit\Framework\TestCase;
use Model\User;
use Database\AthleteEntity;
use Database\AthleteGateway;
use Database\Connexion;
use Database\AthleteMapper;
class MapperTest extends TestCase {
public function testMapperAthlete() {
//$dsn = "pgsql:host=londres;port=8888;dbname=dbkemonteiro2;user=kemonteiro2;password=Mdp";
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
$username = "kemonteiro2";
$password = "#Phpmyadmin63";
$connexion = new Connexion($dsn,$username,$password);
$athleteGateway = new AthleteGateway($connexion);
$result = $athleteGateway->getAthlete();
$map = new AthleteMapper ();
//SQL To AthleteEntity
$athleteEntity = $map->athleteSqlToEntity($result);
foreach($athleteEntity as $ath){
$result = $ath->getNom();
var_dump($result);
//Pour chaque AthleteEntity : Athlete Entity To User avec Role Athlete(Model)
$user = $map->athleteEntityToModel($ath);
var_dump($user->getId());
//Pour chaque Athlete du Model -> Athlete Entity
$res = $map->athleteToEntity($user);
var_dump($res->getIdAthlete());
}
}
}