ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
IdentificationTestTBD.php
Go to the documentation of this file.
1 <?php
2 
20 
30 use ilPlugin;
31 use Mockery;
34 use LogicException;
35 
36 require_once('./vendor/composer/vendor/autoload.php');
37 
43 #[BackupGlobals(false)]
44 #[BackupStaticProperties(false)]
45 #[PreserveGlobalState(false)]
46 #[RunTestsInSeparateProcesses]
47 class IdentificationTest extends TestCase
48 {
50  public const MOCKED_PROVIDER_CLASSNAME = 'Mockery_1_ILIAS_GlobalScreen_Provider_Provider';
58  private $provider_mock;
62  private $plugin_mock;
64 
65 
69  protected function setUp(): void
70  {
71  parent::setUp();
72 
73  $this->plugin_mock = Mockery::mock(ilPlugin::class);
74 
75  $this->provider_mock = Mockery::mock(Provider::class);
76  $this->provider_mock->shouldReceive('getProviderNameForPresentation')->andReturn('Provider')->byDefault();
77 
78  $this->provider_factory = Mockery::mock(ProviderFactory::class);
79  $this->provider_factory->shouldReceive('getProviderByClassName')->with(self::MOCKED_PROVIDER_CLASSNAME)->andReturn($this->provider_mock);
80  $this->provider_factory->shouldReceive('isInstanceCreationPossible')->andReturn(true);
81  $this->provider_factory->shouldReceive('isRegistered')->andReturn(true);
82 
83  $this->identification = new IdentificationFactory($this->provider_factory);
84  }
85 
86 
88  {
89  $string = str_repeat("x", SerializerInterface::MAX_LENGTH - strlen(self::MOCKED_PROVIDER_CLASSNAME) - strlen(CoreSerializer::DIVIDER) + 1);
90  $this->expectException(LogicException::class);
91  $this->identification->core($this->provider_mock)->identifier($string);
92  }
93 
94 
96  {
97  $string = str_repeat("x", SerializerInterface::MAX_LENGTH - strlen(self::MOCKED_PROVIDER_CLASSNAME) - strlen(CoreSerializer::DIVIDER));
98  $this->identification->core($this->provider_mock)->identifier($string);
99  $this->assertTrue(true); // No Exception is thrown
100  }
101 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class IdentificationFactory All elements in the GlobalScreen service must be identifiable for the sup...