ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCtrlStructureCidGeneratorTest Class Reference

Class ilCtrlStructureCidGeneratorTest. More...

+ Inheritance diagram for ilCtrlStructureCidGeneratorTest:
+ Collaboration diagram for ilCtrlStructureCidGeneratorTest:

Public Member Functions

 testCidGeneratorIncrements ()
 
 testCidGeneratorPositiveContinuousIncrements ()
 
 testCidGeneratorNegativeContinuousIncrements ()
 
 testCidGeneratorContinuousIncrementsFromMaxIntegerValue ()
 
 testCidGeneratorIndexByCidValue ()
 
 testCidGeneratorCidByIndexValue ()
 

Detailed Description

Member Function Documentation

◆ testCidGeneratorCidByIndexValue()

ilCtrlStructureCidGeneratorTest::testCidGeneratorCidByIndexValue ( )

Definition at line 70 of file ilCtrlStructureCidGeneratorTest.php.

70  : void
71  {
72  $generator = new ilCtrlStructureCidGenerator();
73 
74  $this->assertEquals('255r', $generator->getCidByIndex(99999));
75  $this->assertEquals('-255r', $generator->getCidByIndex(-99999));
76  $this->assertEquals('0', $generator->getCidByIndex(0));
77  $this->assertEquals('0', $generator->getCidByIndex(-0));
78  $this->assertEquals('1', $generator->getCidByIndex(1));
79  $this->assertEquals('-1', $generator->getCidByIndex(-1));
80  }
Class ilCtrlStructureCidGenerator.

◆ testCidGeneratorContinuousIncrementsFromMaxIntegerValue()

ilCtrlStructureCidGeneratorTest::testCidGeneratorContinuousIncrementsFromMaxIntegerValue ( )

Definition at line 49 of file ilCtrlStructureCidGeneratorTest.php.

49  : void
50  {
51  $generator = new ilCtrlStructureCidGenerator(9223372036854775807);
52 
53  $this->expectException(TypeError::class);
54  $this->expectExceptionMessage('Cannot increment property ilCtrlStructureCidGenerator::$index of type int past its maximal value');
55  $cid = $generator->getCid();
56  }
Class ilCtrlStructureCidGenerator.

◆ testCidGeneratorIncrements()

ilCtrlStructureCidGeneratorTest::testCidGeneratorIncrements ( )

Definition at line 16 of file ilCtrlStructureCidGeneratorTest.php.

16  : void
17  {
18  $generator = new ilCtrlStructureCidGenerator();
19  $first_cid = $generator->getCid();
20  $next_cid = $generator->getCid();
21 
22  $this->assertEquals('0', $first_cid);
23  $this->assertNotEquals('0', $next_cid);
24  $this->assertEquals('1', $next_cid);
25  }
Class ilCtrlStructureCidGenerator.

◆ testCidGeneratorIndexByCidValue()

ilCtrlStructureCidGeneratorTest::testCidGeneratorIndexByCidValue ( )

Definition at line 58 of file ilCtrlStructureCidGeneratorTest.php.

58  : void
59  {
60  $generator = new ilCtrlStructureCidGenerator();
61 
62  $this->assertEquals(99999, $generator->getIndexByCid('255r'));
63  $this->assertEquals(-99999, $generator->getIndexByCid('-255r'));
64  $this->assertEquals(0, $generator->getIndexByCid('0'));
65  $this->assertEquals(0, $generator->getIndexByCid('-0'));
66  $this->assertEquals(1, $generator->getIndexByCid('1'));
67  $this->assertEquals(-1, $generator->getIndexByCid('-1'));
68  }
Class ilCtrlStructureCidGenerator.

◆ testCidGeneratorNegativeContinuousIncrements()

ilCtrlStructureCidGeneratorTest::testCidGeneratorNegativeContinuousIncrements ( )

Definition at line 38 of file ilCtrlStructureCidGeneratorTest.php.

38  : void
39  {
40  $generator = new ilCtrlStructureCidGenerator(-100);
41  $first_cid = $generator->getCid();
42  $next_cid = $generator->getCid();
43 
44  $this->assertEquals('-2s', $first_cid);
45  $this->assertNotEquals('-2s', $next_cid);
46  $this->assertEquals('-2r', $next_cid);
47  }
Class ilCtrlStructureCidGenerator.

◆ testCidGeneratorPositiveContinuousIncrements()

ilCtrlStructureCidGeneratorTest::testCidGeneratorPositiveContinuousIncrements ( )

Definition at line 27 of file ilCtrlStructureCidGeneratorTest.php.

27  : void
28  {
29  $generator = new ilCtrlStructureCidGenerator(100);
30  $first_cid = $generator->getCid();
31  $next_cid = $generator->getCid();
32 
33  $this->assertEquals('2s', $first_cid);
34  $this->assertNotEquals('2s', $next_cid);
35  $this->assertEquals('2t', $next_cid);
36  }
Class ilCtrlStructureCidGenerator.

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