ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
AddLabelTest Class Reference

TestCase for AddLabel transformations. More...

+ Inheritance diagram for AddLabelTest:
+ Collaboration diagram for AddLabelTest:

Public Member Functions

 testTransform ()
 
 testTransformFails ()
 
 testInvoke ()
 
 testInvokeFails ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Static Protected Attributes

static $labels = array("A", "B", "C")
 
static $test_array = array(1, 2, 3)
 
static $result_array = array("A"=>1, "B"=>2, "C"=>3)
 

Detailed Description

TestCase for AddLabel transformations.

Author
Stefan Hecken stefa.nosp@m.n.he.nosp@m.cken@.nosp@m.conc.nosp@m.epts-.nosp@m.and-.nosp@m.train.nosp@m.ing..nosp@m.de

Definition at line 12 of file AddLabelTest.php.

Member Function Documentation

◆ setUp()

AddLabelTest::setUp ( )
protected

Definition at line 18 of file AddLabelTest.php.

19  {
20  $this->f = new Transformation\Factory();
21  $this->add_label = $this->f->addLabels(self::$labels);
22  }

◆ tearDown()

AddLabelTest::tearDown ( )
protected

Definition at line 24 of file AddLabelTest.php.

25  {
26  $this->f = null;
27  $this->add_label = null;
28  }

◆ testInvoke()

AddLabelTest::testInvoke ( )

Definition at line 75 of file AddLabelTest.php.

76  {
77  $add_label = $this->f->addLabels(self::$labels);
78  $with = $add_label(self::$test_array);
79  $this->assertEquals(self::$result_array, $with);
80  }

◆ testInvokeFails()

AddLabelTest::testInvokeFails ( )

Definition at line 82 of file AddLabelTest.php.

References array.

83  {
84  $add_label = $this->f->addLabels(self::$labels);
85 
86  $raised = false;
87  try {
88  $with = null;
89  $next_with = $add_label($with);
90  } catch (InvalidArgumentException $e) {
91  $raised = true;
92  }
93  $this->assertTrue($raised);
94 
95  $raised = false;
96  try {
97  $without = array(1, 2, 3, 4);
98  $with = $add_label($without);
99  } catch (InvalidArgumentException $e) {
100  $raised = true;
101  }
102  $this->assertTrue($raised);
103 
104  $raised = false;
105  try {
106  $without = "1, 2, 3";
107  $with = $add_label($without);
108  } catch (InvalidArgumentException $e) {
109  $raised = true;
110  }
111  $this->assertTrue($raised);
112 
113  $raised = false;
114  try {
115  $std_class = new stdClass();
116  $with = $add_label($std_class);
117  } catch (InvalidArgumentException $e) {
118  $raised = true;
119  }
120  $this->assertTrue($raised);
121  }
Create styles array
The data for the language used.

◆ testTransform()

AddLabelTest::testTransform ( )

Definition at line 30 of file AddLabelTest.php.

31  {
32  $with = $this->add_label->transform(self::$test_array);
33  $this->assertEquals(self::$result_array, $with);
34  }

◆ testTransformFails()

AddLabelTest::testTransformFails ( )

Definition at line 36 of file AddLabelTest.php.

References array.

37  {
38  $raised = false;
39  try {
40  $with = null;
41  $next_with = $this->add_label->transform($with);
42  } catch (InvalidArgumentException $e) {
43  $raised = true;
44  }
45  $this->assertTrue($raised);
46 
47  $raised = false;
48  try {
49  $without = array(1, 2, 3, 4);
50  $with = $this->add_label->transform($without);
51  } catch (InvalidArgumentException $e) {
52  $raised = true;
53  }
54  $this->assertTrue($raised);
55 
56  $raised = false;
57  try {
58  $without = "1, 2, 3";
59  $with = $this->add_label->transform($without);
60  } catch (InvalidArgumentException $e) {
61  $raised = true;
62  }
63  $this->assertTrue($raised);
64 
65  $raised = false;
66  try {
67  $std_class = new stdClass();
68  $with = $this->add_label->transform($std_class);
69  } catch (InvalidArgumentException $e) {
70  $raised = true;
71  }
72  $this->assertTrue($raised);
73  }
Create styles array
The data for the language used.

Field Documentation

◆ $labels

AddLabelTest::$labels = array("A", "B", "C")
staticprotected

Definition at line 14 of file AddLabelTest.php.

◆ $result_array

AddLabelTest::$result_array = array("A"=>1, "B"=>2, "C"=>3)
staticprotected

Definition at line 16 of file AddLabelTest.php.

◆ $test_array

AddLabelTest::$test_array = array(1, 2, 3)
staticprotected

Definition at line 15 of file AddLabelTest.php.


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