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.
67 lines
2.0 KiB
67 lines
2.0 KiB
<?php
|
|
|
|
namespace TestBusinessClass;
|
|
|
|
use BusinessClass\Form;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class FormTest extends TestCase
|
|
{
|
|
public function testGetTitleReturnsCorrectValue()
|
|
{
|
|
$form = new Form(1, 'Titre du formulaire', 'Description du formulaire', []);
|
|
$this->assertEquals('Titre du formulaire', $form->getTitle());
|
|
}
|
|
|
|
public function testSetTitleSetsCorrectValue()
|
|
{
|
|
$form = new Form(1, 'Titre du formulaire', 'Description du formulaire', []);
|
|
$form->setTitle('Nouveau titre');
|
|
$this->assertEquals('Nouveau titre', $form->getTitle());
|
|
}
|
|
|
|
public function testGetDescriptionReturnsCorrectValue()
|
|
{
|
|
$form = new Form(1, 'Titre du formulaire', 'Description du formulaire', []);
|
|
$this->assertEquals('Description du formulaire', $form->getDescription());
|
|
}
|
|
|
|
public function testSetDescriptionSetsCorrectValue()
|
|
{
|
|
$form = new Form(1, 'Titre du formulaire', 'Description du formulaire', []);
|
|
$form->setDescription('Nouvelle description');
|
|
$this->assertEquals('Nouvelle description', $form->getDescription());
|
|
}
|
|
|
|
public function testGetQuestionsReturnsCorrectValue()
|
|
{
|
|
$questions = [
|
|
'Question 1',
|
|
'Question 2',
|
|
'Question 3'
|
|
];
|
|
|
|
$form = new Form(1, 'Titre du formulaire', 'Description du formulaire', $questions);
|
|
$this->assertEquals($questions, $form->getQuestions());
|
|
}
|
|
|
|
public function testSetQuestionsSetsCorrectValue()
|
|
{
|
|
$questions = [
|
|
'Question 1',
|
|
'Question 2',
|
|
'Question 3'
|
|
];
|
|
|
|
$form = new Form(1, 'Titre du formulaire', 'Description du formulaire', []);
|
|
$form->setQuestions($questions);
|
|
$this->assertEquals($questions, $form->getQuestions());
|
|
}
|
|
|
|
public function testGetIdReturnsCorrectValue()
|
|
{
|
|
$form = new Form(1, 'Titre du formulaire', 'Description du formulaire', []);
|
|
$this->assertEquals(1, $form->getId());
|
|
}
|
|
}
|