ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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_mock
 
IdentificationFactory $identification
 

Detailed Description

Member Function Documentation

◆ setUp()

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

@inheritDoc

Definition at line 61 of file IdentificationTestTBD.php.

61 : void
62 {
63 parent::setUp();
64
65 $plugin_mock = Mockery::mock(ilPlugin::class);
66
67 $this->provider_mock = Mockery::mock(Provider::class);
68 $this->provider_mock->shouldReceive('getProviderNameForPresentation')->andReturn('Provider')->byDefault();
69
70 $provider_factory = Mockery::mock(ProviderFactory::class);
71 $provider_factory->shouldReceive('getProviderByClassName')->with(self::MOCKED_PROVIDER_CLASSNAME)->andReturn($this->provider_mock);
72 $provider_factory->shouldReceive('isInstanceCreationPossible')->andReturn(true);
73 $provider_factory->shouldReceive('isRegistered')->andReturn(true);
74
75 $this->identification = new IdentificationFactory($provider_factory);
76 }

◆ testMustNotThrowExceptionSinceSerializedIdentificationIsExactLength()

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

Definition at line 87 of file IdentificationTestTBD.php.

87 : void
88 {
89 $string = str_repeat("x", SerializerInterface::MAX_LENGTH - strlen(self::MOCKED_PROVIDER_CLASSNAME) - strlen(CoreSerializer::DIVIDER));
90 $this->identification->core($this->provider_mock)->identifier($string);
91 $this->assertTrue(true); // No Exception is thrown
92 }

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

◆ testMustThrowExceptionSinceSerializedIdentificationIsTooLong()

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

Definition at line 79 of file IdentificationTestTBD.php.

79 : void
80 {
81 $string = str_repeat("x", SerializerInterface::MAX_LENGTH - strlen(self::MOCKED_PROVIDER_CLASSNAME) - strlen(CoreSerializer::DIVIDER) + 1);
82 $this->expectException(LogicException::class);
83 $this->identification->core($this->provider_mock)->identifier($string);
84 }

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 55 of file IdentificationTestTBD.php.

◆ $provider_mock

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

Definition at line 54 of file IdentificationTestTBD.php.

◆ MOCKED_PROVIDER_CLASSNAME

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

Definition at line 50 of file IdentificationTestTBD.php.


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