Skip to content

Commit 18cb518

Browse files
committed
[php][divergent_change-01_base] Add test for step validation
1 parent 09fd563 commit 18cb518

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

examples/php/php-divergent_change-01_base/tests/Controller/CourseStepsGetTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,27 @@ public function shouldReturnExistingCourseSteps(): void
5454
$expected = '[{"id":"uuid","type":"video","duration":14.3,"points":1430},{"id":"uuid","type":"quiz","duration":2.5,"points":25}]';
5555
self::assertSame($expected, $results);
5656
}
57+
58+
/** @test */
59+
public function shouldIgnoreStepsWithInvalidType(): void
60+
{
61+
$platform = $this->createMock(Platform::class);
62+
$platform
63+
->method('findCourseSteps')
64+
->with('73D74817-CC25-477D-BF3E-36130087293F')
65+
->willReturn([
66+
[
67+
'id' => 'uuid',
68+
'type' => 'survey',
69+
'questions' => null,
70+
'duration' => 13
71+
]
72+
]);
73+
74+
$sut = new CourseStepsGetController($platform);
75+
76+
$results = $sut->get('73D74817-CC25-477D-BF3E-36130087293F');
77+
78+
self::assertSame('[]', $results);
79+
}
5780
}

0 commit comments

Comments
 (0)