ILIAS  release_8 Revision v8.24
ILIAS\GlobalScreen\MainMenu\IdentificationTest Class Reference

Class IdentificationFactoryTest. More...

+ Inheritance diagram for ILIAS\GlobalScreen\MainMenu\IdentificationTest:
+ Collaboration diagram for ILIAS\GlobalScreen\MainMenu\IdentificationTest:

Public Member Functions

 testMustThrowExceptionSinceSerializedIdentificationIsTooLong ()
 
 testMustNotThrowExceptionSinceSerializedIdentificationIsExactLength ()
 

Data Fields

const MOCKED_PROVIDER_CLASSNAME = 'Mockery_1_ILIAS_GlobalScreen_Provider_Provider'
 

Protected Member Functions

 setUp ()
 @inheritDoc More...
 

Private Attributes

 $provider_factory
 
 $provider_mock
 
 $plugin_mock
 
IdentificationFactory $identification
 

Detailed Description

Class IdentificationFactoryTest.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

@runTestsInSeparateProcesses @preserveGlobalState disabled @backupGlobals disabled @backupStaticAttributes disabled

Definition at line 44 of file IdentificationTest.php.

Member Function Documentation

◆ setUp()

ILIAS\GlobalScreen\MainMenu\IdentificationTest::setUp ( )
protected

@inheritDoc

Definition at line 66 of file IdentificationTest.php.

66 : void
67 {
68 parent::setUp();
69
70 $this->plugin_mock = Mockery::mock(ilPlugin::class);
71
72 $this->provider_mock = Mockery::mock(Provider::class);
73 $this->provider_mock->shouldReceive('getProviderNameForPresentation')->andReturn('Provider')->byDefault();
74
75 $this->provider_factory = Mockery::mock(ProviderFactory::class);
76 $this->provider_factory->shouldReceive('getProviderByClassName')->with(self::MOCKED_PROVIDER_CLASSNAME)->andReturn($this->provider_mock);
77 $this->provider_factory->shouldReceive('isInstanceCreationPossible')->andReturn(true);
78 $this->provider_factory->shouldReceive('isRegistered')->andReturn(true);
79
80 $this->identification = new IdentificationFactory($this->provider_factory);
81 }
Class IdentificationFactory All elements in the GlobalScreen service must be identifiable for the sup...

◆ testMustNotThrowExceptionSinceSerializedIdentificationIsExactLength()

ILIAS\GlobalScreen\MainMenu\IdentificationTest::testMustNotThrowExceptionSinceSerializedIdentificationIsExactLength ( )

Definition at line 92 of file IdentificationTest.php.

92 : void
93 {
94 $string = str_repeat("x", SerializerInterface::MAX_LENGTH - strlen(self::MOCKED_PROVIDER_CLASSNAME) - strlen(CoreSerializer::DIVIDER));
95 $this->identification->core($this->provider_mock)->identifier($string);
96 $this->assertTrue(true); // No Exception is thrown
97 }

References ILIAS\GlobalScreen\Identification\Serializer\CoreSerializer\DIVIDER, and ILIAS\GlobalScreen\Identification\Serializer\SerializerInterface\MAX_LENGTH.

◆ testMustThrowExceptionSinceSerializedIdentificationIsTooLong()

ILIAS\GlobalScreen\MainMenu\IdentificationTest::testMustThrowExceptionSinceSerializedIdentificationIsTooLong ( )

Definition at line 84 of file IdentificationTest.php.

84 : void
85 {
86 $string = str_repeat("x", SerializerInterface::MAX_LENGTH - strlen(self::MOCKED_PROVIDER_CLASSNAME) - strlen(CoreSerializer::DIVIDER) + 1);
87 $this->expectException(LogicException::class);
88 $this->identification->core($this->provider_mock)->identifier($string);
89 }

References ILIAS\GlobalScreen\Identification\Serializer\CoreSerializer\DIVIDER, and ILIAS\GlobalScreen\Identification\Serializer\SerializerInterface\MAX_LENGTH.

Field Documentation

◆ $identification

IdentificationFactory ILIAS\GlobalScreen\MainMenu\IdentificationTest::$identification
private

Definition at line 60 of file IdentificationTest.php.

◆ $plugin_mock

ILIAS\GlobalScreen\MainMenu\IdentificationTest::$plugin_mock
private

Definition at line 59 of file IdentificationTest.php.

◆ $provider_factory

ILIAS\GlobalScreen\MainMenu\IdentificationTest::$provider_factory
private

Definition at line 51 of file IdentificationTest.php.

◆ $provider_mock

ILIAS\GlobalScreen\MainMenu\IdentificationTest::$provider_mock
private

Definition at line 55 of file IdentificationTest.php.

◆ MOCKED_PROVIDER_CLASSNAME

const ILIAS\GlobalScreen\MainMenu\IdentificationTest::MOCKED_PROVIDER_CLASSNAME = 'Mockery_1_ILIAS_GlobalScreen_Provider_Provider'

Definition at line 47 of file IdentificationTest.php.


The documentation for this class was generated from the following file: