Cześć.
Uczę się pisać test TDD. I mam jedne problem , którego nie wiem jak przeskoczyć. Otóż mam taki kod:
public function testShouldReturnTrueWeCheckWithFullyTable()
{
// Given
$checkExist = new CheckExist();
$task = new Task();
$taskChildren = new TaskChildren();
// When
$task->setTaskChildren($taskChildren);
$result = $checkExist->next($task);
// Then
$this->assertEquals(true,$result);
}
I testuje :
public function next(Task $task = null)
{
$next = false;
if ($task){
foreach ($task->getTaskChildren() as $item){
if ($item){
$next = true;
}
}
}
return $next;
}
I Problem w tym ,że ciągle wywala mi błędy, że muszę zaimplementować Doctrina:
1) App\Tests\Model\Task\CheckExistTest::testShouldReturnTrueWeCheckWithFullyTable
TypeError: Return value of App\Entity\Task::getTaskChildren() must implement interface Doctrine\Common\Collections\Collection, instance of App\Entity\TaskChildren returned
C:\eco\tdd\src\Entity\Task.php:189
C:\eco\tdd\src\Model\CheckExist.php:14
C:\eco\tdd\tests\Model\Task\CheckExistTest.php:37
Z góry dziękuje za pomoc lub jakąś wskazówkę.