ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ()
 

Private Attributes

 $provider_factory
 
 $provider_mock
 
 $plugin_mock
 
 $identification
 

Detailed Description

Class IdentificationFactoryTest.

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

disabled disabled disabled

Definition at line 27 of file IdentificationTest.php.

Member Function Documentation

◆ setUp()

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

Definition at line 52 of file IdentificationTest.php.

53  {
54  parent::setUp();
55 
56  $this->plugin_mock = Mockery::mock(ilPlugin::class);
57 
58  $this->provider_mock = Mockery::mock(Provider::class);
59  $this->provider_mock->shouldReceive('getProviderNameForPresentation')->andReturn('Provider')->byDefault();
60 
61  $this->provider_factory = Mockery::mock(ProviderFactoryInterface::class);
62  $this->provider_factory->shouldReceive('getProviderByClassName')->with(self::MOCKED_PROVIDER_CLASSNAME)->andReturn($this->provider_mock);
63  $this->provider_factory->shouldReceive('isInstanceCreationPossible')->andReturn(true);
64  $this->provider_factory->shouldReceive('isRegistered')->andReturn(true);
65 
66  $this->identification = new IdentificationFactory($this->provider_factory);
67  }

◆ testMustNotThrowExceptionSinceSerializedIdentificationIsExactLength()

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

Definition at line 78 of file IdentificationTest.php.

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

79  {
80  $string = str_repeat("x", SerializerInterface::MAX_LENGTH - strlen(self::MOCKED_PROVIDER_CLASSNAME) - strlen(CoreSerializer::DIVIDER));
81  $this->identification->core($this->provider_mock)->identifier($string);
82  }

◆ testMustThrowExceptionSinceSerializedIdentificationIsTooLong()

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

Definition at line 70 of file IdentificationTest.php.

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

71  {
72  $string = str_repeat("x", SerializerInterface::MAX_LENGTH - strlen(self::MOCKED_PROVIDER_CLASSNAME) - strlen(CoreSerializer::DIVIDER) + 1);
73  $this->expectException(\LogicException::class);
74  $this->identification->core($this->provider_mock)->identifier($string);
75  }

Field Documentation

◆ $identification

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

Definition at line 46 of file IdentificationTest.php.

◆ $plugin_mock

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

Definition at line 42 of file IdentificationTest.php.

◆ $provider_factory

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

Definition at line 34 of file IdentificationTest.php.

◆ $provider_mock

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

Definition at line 38 of file IdentificationTest.php.

◆ MOCKED_PROVIDER_CLASSNAME

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

Definition at line 30 of file IdentificationTest.php.


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