ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilServicesPreviewTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
23 
24 class ilServicesPreviewTest extends TestCase
25 {
31 
32  protected function setUp(): void
33  {
34  global $DIC;
35  $this->dic_backup = is_object($DIC) ? clone $DIC : $DIC;
36 
37  $DIC = new Container();
38  $this->db_mock = $DIC['ilDB'] = $this->createMock(ilDBInterface::class);
39  }
40 
41  protected function tearDown(): void
42  {
43  global $DIC;
44  $DIC = $this->dic_backup;
45  }
46 
48  public function testRendererFactory(): void
49  {
50  // TODO eactivate Tests agian
51  $this->markTestSkipped('Currently the implementation cant be tested');
52  return;
53 
55  $preview = new ilPreview(0, 'file');
56 
57  $files_backup = $_FILES;
58 
59  $_FILES['file']['name'] = 'test.jpg';
60  $this->assertInstanceOf(ilImageMagickRenderer::class, $factory->getRenderer($preview));
61 
62  $_FILES['file']['name'] = 'test.tiff';
63  $this->assertInstanceOf(ilImageMagickRenderer::class, $factory->getRenderer($preview));
64 
65  $_FILES['file']['name'] = 'test.pdf';
66  $this->assertInstanceOf(ilGhostscriptRenderer::class, $factory->getRenderer($preview));
67 
68  $_FILES['file']['name'] = 'test.eps';
69  $this->assertInstanceOf(ilGhostscriptRenderer::class, $factory->getRenderer($preview));
70 
71  $_FILES['file']['name'] = 'test.mp4';
72  $this->assertNull($factory->getRenderer($preview));
73 
74  $_FILES = $files_backup;
75  }
76 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
testRendererFactory()
PhpArrayIndexImmediatelyRewrittenInspection
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
global $DIC
Definition: feed.php:28
$preview
Definition: imgupload.php:81
ILIAS DI Container $dic_backup
$factory
Definition: metadata.php:75