ILIAS
release_8 Revision v8.24
◀ ilDoc Overview
PageReadingTimeTest.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\ContentPage
;
22
23
use
ILIAS\ContentPage\PageMetrics\ValueObject\PageReadingTime
;
24
use PHPUnit\Framework\TestCase;
25
use TypeError;
26
use stdClass;
27
32
class
PageReadingTimeTest
extends
TestCase
33
{
34
public
function
mixedReadingTypesProvider
(): array
35
{
36
return
[
37
'Float Type'
=> [4.0],
38
'String Type'
=> [
'4'
],
39
'Array Type'
=> [[4]],
40
'Object Type'
=> [
new
stdClass()],
41
'Boolean Type'
=> [
false
],
42
'Null Type'
=> [
null
],
43
'Ressource Type'
=> [fopen(
'php://temp'
,
'rb'
)]
44
];
45
}
46
51
public
function
testPageReadingTimeValueThrowsExceptionWhenConstructedWithInvalidTypes
($mixedType): void
52
{
53
$this->expectException(TypeError::class);
54
55
$readingTime =
new
PageReadingTime
($mixedType);
56
}
57
58
public
function
testRawReadingTimeCanBeRetrievedFromValueObject
(): void
59
{
60
$readingTime =
new
PageReadingTime
(5);
61
$this->assertSame(5, $readingTime->minutes());
62
}
63
}
ILIAS\ContentPage\PageMetrics\ValueObject\PageReadingTime
Definition:
PageReadingTime.php:31
ILIAS\ContentPage\PageReadingTimeTest
Class PageReadingTimeTest.
Definition:
PageReadingTimeTest.php:33
ILIAS\ContentPage\PageReadingTimeTest\testPageReadingTimeValueThrowsExceptionWhenConstructedWithInvalidTypes
testPageReadingTimeValueThrowsExceptionWhenConstructedWithInvalidTypes($mixedType)
Definition:
PageReadingTimeTest.php:51
ILIAS\ContentPage\PageReadingTimeTest\testRawReadingTimeCanBeRetrievedFromValueObject
testRawReadingTimeCanBeRetrievedFromValueObject()
Definition:
PageReadingTimeTest.php:58
ILIAS\ContentPage\PageReadingTimeTest\mixedReadingTypesProvider
mixedReadingTypesProvider()
Definition:
PageReadingTimeTest.php:34
ILIAS\ContentPage
Modules
ContentPage
test
PageReadingTimeTest.php
Generated on Mon Nov 3 2025 22:01:18 for ILIAS by
1.9.4 (using
Doxyfile
)