ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
RangeTest Class Reference
+ Inheritance diagram for RangeTest:
+ Collaboration diagram for RangeTest:

Public Member Functions

 testFactory ()
 
 testValues (Range $range)
 
 testEndCalculation (Range $range)
 
 testWithLength (Range $range)
 
 testWithStart (Range $range)
 
 testUnpack (Range $range)
 
 testNegativeStart (Range $range)
 
 testNegativeLength (Range $range)
 
 testConstructionWrongStart ()
 
 testConstructionWrongLength ()
 
 testCroppedTo ($start, $length, $max, $has_changed)
 

Static Public Member Functions

static cropCases ()
 

Detailed Description

Member Function Documentation

◆ cropCases()

static RangeTest::cropCases ( )
static

Definition at line 122 of file RangeTest.php.

122 : array
123 {
124 return [
125 [0, 100, 1000, false],
126 [0, 1000, 100, true],
127 [50, 100, 75, true],
128 [50, 100, 200, false],
129 [100, 100, 50, true]
130 ];
131 }

◆ testConstructionWrongLength()

RangeTest::testConstructionWrongLength ( )

Definition at line 100 of file RangeTest.php.

100 : void
101 {
102 $this->expectException(InvalidArgumentException::class);
103 $f = new ILIAS\Data\Factory();
104 $range = $f->range(1, -2);
105 }
Builds data types.
Definition: Factory.php:36

References Vendor\Package\$f, and ILIAS\UI\Implementation\Component\Table\$range.

◆ testConstructionWrongStart()

RangeTest::testConstructionWrongStart ( )

Definition at line 93 of file RangeTest.php.

93 : void
94 {
95 $this->expectException(InvalidArgumentException::class);
96 $f = new ILIAS\Data\Factory();
97 $range = $f->range(-1, 2);
98 }

References Vendor\Package\$f, and ILIAS\UI\Implementation\Component\Table\$range.

◆ testCroppedTo()

RangeTest::testCroppedTo (   $start,
  $length,
  $max,
  $has_changed 
)

Definition at line 108 of file RangeTest.php.

108 : void
109 {
110 $f = new ILIAS\Data\Factory();
111 $range = $f->range($start, $length);
112 $cropped = $range->croppedTo($max);
113
114 if (!$has_changed) {
115 $this->assertEquals($range, $cropped);
116 } else {
117 $this->assertEquals(min($max, $start), $cropped->getStart());
118 $this->assertEquals($max, $cropped->getEnd());
119 }
120 }
croppedTo(int $max)
This will create a range that is guaranteed to not exceed $max.
Definition: Range.php:98

References Vendor\Package\$f, ILIAS\UI\Implementation\Component\Table\$range, and ILIAS\Data\Range\croppedTo().

+ Here is the call graph for this function:

◆ testEndCalculation()

RangeTest::testEndCalculation ( Range  $range)

Definition at line 45 of file RangeTest.php.

45 : void
46 {
47 $this->assertEquals(3, $range->getEnd());
48 }

References ILIAS\UI\Implementation\Component\Table\$range, and ILIAS\Data\Range\getEnd().

+ Here is the call graph for this function:

◆ testFactory()

RangeTest::testFactory ( )

Definition at line 29 of file RangeTest.php.

29 : Range
30 {
31 $f = new ILIAS\Data\Factory();
32 $range = $f->range(1, 2);
33 $this->assertInstanceOf(Range::class, $range);
34 return $range;
35 }
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:29

References Vendor\Package\$f, and ILIAS\UI\Implementation\Component\Table\$range.

◆ testNegativeLength()

RangeTest::testNegativeLength ( Range  $range)

Definition at line 87 of file RangeTest.php.

87 : void
88 {
89 $this->expectException(InvalidArgumentException::class);
91 }
withLength(int $length)
Definition: Range.php:87

References ILIAS\UI\Implementation\Component\Table\$range, and ILIAS\Data\Range\withLength().

+ Here is the call graph for this function:

◆ testNegativeStart()

RangeTest::testNegativeStart ( Range  $range)

Definition at line 80 of file RangeTest.php.

80 : void
81 {
82 $this->expectException(InvalidArgumentException::class);
83 $range = $range->withStart(-5);
84 }
withStart(int $start)
Definition: Range.php:79

References ILIAS\UI\Implementation\Component\Table\$range, and ILIAS\Data\Range\withStart().

+ Here is the call graph for this function:

◆ testUnpack()

RangeTest::testUnpack ( Range  $range)

Definition at line 71 of file RangeTest.php.

71 : void
72 {
73 $this->assertEquals(
74 [3,3],
75 $range->unpack()
76 );
77 }

References ILIAS\UI\Implementation\Component\Table\$range, and ILIAS\Data\Range\unpack().

+ Here is the call graph for this function:

◆ testValues()

RangeTest::testValues ( Range  $range)

Definition at line 38 of file RangeTest.php.

38 : void
39 {
40 $this->assertEquals(1, $range->getStart());
41 $this->assertEquals(2, $range->getLength());
42 }

References ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Data\Range\getLength(), and ILIAS\Data\Range\getStart().

+ Here is the call graph for this function:

◆ testWithLength()

RangeTest::testWithLength ( Range  $range)

Definition at line 51 of file RangeTest.php.

51 : Range
52 {
54 $this->assertEquals(1, $range->getStart());
55 $this->assertEquals(3, $range->getLength());
56 $this->assertEquals(4, $range->getEnd());
57 return $range;
58 }

References ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Data\Range\getEnd(), ILIAS\Data\Range\getLength(), ILIAS\Data\Range\getStart(), and ILIAS\Data\Range\withLength().

+ Here is the call graph for this function:

◆ testWithStart()

RangeTest::testWithStart ( Range  $range)

Definition at line 61 of file RangeTest.php.

61 : Range
62 {
64 $this->assertEquals(3, $range->getStart());
65 $this->assertEquals(3, $range->getLength());
66 $this->assertEquals(6, $range->getEnd());
67 return $range;
68 }

References ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Data\Range\getEnd(), ILIAS\Data\Range\getLength(), ILIAS\Data\Range\getStart(), and ILIAS\Data\Range\withStart().

+ Here is the call graph for this function:

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