ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
PageReadingTimeTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\ContentPage;
22 
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 
52  {
53  $this->expectException(TypeError::class);
54 
55  $readingTime = new PageReadingTime($mixedType);
56  }
57 
59  {
60  $readingTime = new PageReadingTime(5);
61  $this->assertSame(5, $readingTime->minutes());
62  }
63 }
testPageReadingTimeValueThrowsExceptionWhenConstructedWithInvalidTypes($mixedType)