ILIAS
trunk Revision v11.0_alpha-2645-g16283d3b3f8
◀ 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
use
PHPUnit\Framework\Attributes\DataProvider
;
28
29
class
PageReadingTimeTest
extends
TestCase
30
{
31
public
static
function
mixedReadingTypesProvider
(): array
32
{
33
return
[
34
'Float Type'
=> [4.0],
35
'String Type'
=> [
'4'
],
36
'Array Type'
=> [[4]],
37
'Object Type'
=> [
new
stdClass
()],
38
'Boolean Type'
=> [
false
],
39
'Null Type'
=> [
null
],
40
'Ressource Type'
=> [fopen(
'php://temp'
,
'rb'
)]
41
];
42
}
43
44
#[DataProvider('mixedReadingTypesProvider')]
45
public
function
testPageReadingTimeValueThrowsExceptionWhenConstructedWithInvalidTypes
(mixed $mixedType): void
46
{
47
$this->expectException(TypeError::class);
48
49
$readingTime =
new
PageReadingTime($mixedType);
50
}
51
52
public
function
testRawReadingTimeCanBeRetrievedFromValueObject
(): void
53
{
54
$readingTime =
new
PageReadingTime(5);
55
$this->assertSame(5, $readingTime->minutes());
56
}
57
}
ILIAS\ContentPage\PageReadingTimeTest
Definition:
PageReadingTimeTest.php:29
stdClass
ILIAS\ContentPage\PageReadingTimeTest\testPageReadingTimeValueThrowsExceptionWhenConstructedWithInvalidTypes
testPageReadingTimeValueThrowsExceptionWhenConstructedWithInvalidTypes(mixed $mixedType)
Definition:
PageReadingTimeTest.php:45
null
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Definition:
shib_logout.php:144
ILIAS\ContentPage
ILIAS\ContentPage\PageReadingTimeTest\mixedReadingTypesProvider
static mixedReadingTypesProvider()
Definition:
PageReadingTimeTest.php:31
TypeError
DataProvider
ILIAS\ContentPage\PageReadingTimeTest\testRawReadingTimeCanBeRetrievedFromValueObject
testRawReadingTimeCanBeRetrievedFromValueObject()
Definition:
PageReadingTimeTest.php:52
PageReadingTime
TestCase
components
ILIAS
ContentPage
tests
PageReadingTimeTest.php
Generated on Mon Sep 1 2025 23:02:46 for ILIAS by
1.8.13 (using
Doxyfile
)