ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
PreProcessorTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
29 
30 require_once __DIR__ . '/../ContainerMock.php';
31 
32 class PreProcessorTest extends TestCase
33 {
34  use ContainerMock;
35 
36  public function testConstruct(): void
37  {
38  $this->assertInstanceOf(PreProcessor::class, new PreProcessor($this->fail(...)));
39  }
40 
41  public function testProcess(): void
42  {
43  $expected_value = 'Dummty content';
44  $value = null;
45  $instance = new PreProcessor(static function (string $content) use (&$value): void {
46  $value = $content;
47  });
48 
49  $result = $instance->process(
50  $this->mockMethod(FileStream::class, 'getContents', [], $expected_value),
51  new Metadata('dummy file name', 1234, 'text/html') // Cannot be mocked because it is final.
52  );
53 
54  $this->assertSame($expected_value, $value);
55  $this->assertInstanceOf(ProcessingStatus::class, $result);
56  $this->assertSame(ProcessingStatus::OK, $result->getCode());
57  $this->assertSame('idontcare', $result->getMessage());
58  }
59 }
process(FileStream $stream, Metadata $metadata)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null