ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
TransformationFactoryTest.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2017 Stefan Hecken <stefan.hecken@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
6 
13 {
14  protected function setUp()
15  {
16  $this->f = new Transformation\Factory();
17  }
18 
19  protected function tearDown()
20  {
21  $this->f = null;
22  }
23 
24  public function testAddLabels()
25  {
26  $add_label = $this->f->addLabels(array("A", "B", "C"));
27  $this->assertInstanceOf(Transformation\Transformation::class, $add_label);
28  }
29 
30  public function testSplitString()
31  {
32  $split_string = $this->f->splitString("#");
33  $this->assertInstanceOf(Transformation\Transformation::class, $split_string);
34  }
35 
36  public function testCustom()
37  {
38  $custom = $this->f->custom(function () {
39  });
40  $this->assertInstanceOf(Transformation\Transformation::class, $custom);
41  }
42 
43  public function testToData()
44  {
45  $data = $this->f->toData('password');
46  $this->assertInstanceOf(Transformation\Transformation::class, $data);
47  }
48 
49  public function testToDataWrongType()
50  {
51  try {
52  $data = $this->f->toData('no_such_type');
53  $this->assertFalse("This should not happen");
54  } catch (\InvalidArgumentException $e) {
55  $this->assertTrue(true);
56  }
57  }
58 }
A transformation is a function from one datatype to another.
TestCase for the factory of transformations.
$data
Definition: bench.php:6