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.
40 lines
926 B
40 lines
926 B
<?php
|
|
|
|
namespace TestBusinessClass;
|
|
|
|
use BusinessClass\Question;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class QuestionTest extends TestCase
|
|
{
|
|
public function testConstructor()
|
|
{
|
|
$id = 1;
|
|
$content = 'What is your name?';
|
|
$question = new class($id, $content) extends Question {
|
|
public function printStrategy(): string
|
|
{
|
|
return '';
|
|
}
|
|
};
|
|
|
|
$this->assertEquals($id, $question->getId());
|
|
$this->assertEquals($content, $question->getContent());
|
|
}
|
|
|
|
public function testSetContent()
|
|
{
|
|
$content = 'What is your age?';
|
|
$question = new class(1, 'question') extends Question {
|
|
public function printStrategy(): string
|
|
{
|
|
return '';
|
|
}
|
|
};
|
|
$question->setContent($content);
|
|
|
|
$this->assertEquals($content, $question->getContent());
|
|
}
|
|
}
|
|
|