tests
This commit is contained in:
parent
f6c07dfa85
commit
863f85ef34
|
@ -7,6 +7,11 @@ class Participant extends Personne
|
|||
*/
|
||||
protected $image;
|
||||
|
||||
/**
|
||||
* @var Pays $pays
|
||||
*/
|
||||
protected $pays;
|
||||
|
||||
/**
|
||||
* @param string $image
|
||||
* @return Participant
|
||||
|
@ -29,4 +34,24 @@ class Participant extends Personne
|
|||
{
|
||||
return $this->image;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Pays $pays
|
||||
*/
|
||||
public function setPays(Pays $pays)
|
||||
{
|
||||
$this->pays = $pays;
|
||||
|
||||
$this->pays->addParticipant($this);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Pays
|
||||
*/
|
||||
public function getPays()
|
||||
{
|
||||
return $this->pays;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,11 @@ class Pays
|
|||
*/
|
||||
protected $symbole;
|
||||
|
||||
/**
|
||||
* @var mixed[] $participants Participants
|
||||
*/
|
||||
protected $participants = [];
|
||||
|
||||
/**
|
||||
* @param string $nom Nom du pays
|
||||
* @param string $symbole Symbole du pays
|
||||
|
@ -94,4 +99,36 @@ class Pays
|
|||
{
|
||||
return $this->symbole;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Pays
|
||||
*/
|
||||
public function addParticipant(Participant $participant)
|
||||
{
|
||||
foreach ($this->getParticipants() as $p) {
|
||||
if ($p === $participant) {
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
$this->participants[] = $participant;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed[] $participants
|
||||
* @return Pays
|
||||
*/
|
||||
public function setParticipants(array $participants)
|
||||
{
|
||||
$this->participants = $participants;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getParticipants()
|
||||
{
|
||||
return $this->participants;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,10 @@ class Video
|
|||
*/
|
||||
public function setTitre($titre)
|
||||
{
|
||||
if ('' === trim((string) $titre)) {
|
||||
throw new InvalidArgumentException('Le titre ne peut pas être vide.');
|
||||
}
|
||||
|
||||
$this->titre = (string) $titre;
|
||||
|
||||
return $this;
|
||||
|
@ -100,6 +104,10 @@ class Video
|
|||
*/
|
||||
public function setFichier($fichier)
|
||||
{
|
||||
if ('' === trim((string) $fichier)) {
|
||||
throw new InvalidArgumentException('Le fichier ne peut pas être vide.');
|
||||
}
|
||||
|
||||
$this->fichier = (string) $fichier;
|
||||
|
||||
return $this;
|
||||
|
@ -119,6 +127,10 @@ class Video
|
|||
*/
|
||||
public function setImage($image)
|
||||
{
|
||||
if ('' === trim((string) $image)) {
|
||||
throw new InvalidArgumentException('L\'image ne peut pas être vide.');
|
||||
}
|
||||
|
||||
$this->image = (string) $image;
|
||||
|
||||
return $this;
|
||||
|
|
Loading…
Reference in a new issue