ILIAS  release_7 Revision v7.30-3-g800a261c036
NullTransformationTest Class Reference

Test kind transformation to null. More...

+ Inheritance diagram for NullTransformationTest:
+ Collaboration diagram for NullTransformationTest:

Public Member Functions

 setUp ()
 
 NullTestDataProvider ()
 
 testNullTransformation ($value, bool $valid)
 NullTestDataProvider More...
 
- Public Member Functions inherited from ILIAS\Tests\Refinery\TestCase
 getLanguage ()
 

Protected Attributes

 $transformation
 NullTransformation. More...
 

Detailed Description

Test kind transformation to null.

Definition at line 14 of file NullTransformationTest.php.

Member Function Documentation

◆ NullTestDataProvider()

NullTransformationTest::NullTestDataProvider ( )

Definition at line 26 of file NullTransformationTest.php.

27  {
28  return [
29  'empty string' => ['', true],
30  'space' => [' ', true],
31  'spaces' => [' ', true],
32  'null' => [null, true],
33  'string' => ['str', false],
34  'int' => [1, false],
35  'negative int' => [-1, false],
36  'zero' => [0, false],
37  'array' => [[], false],
38  'bool (false)' => [false, false],
39  'bool (true)' => [true, false]
40  ];
41  }

◆ setUp()

NullTransformationTest::setUp ( )

Definition at line 21 of file NullTransformationTest.php.

21  : void
22  {
23  $this->transformation = new NullTransformation();
24  }

◆ testNullTransformation()

NullTransformationTest::testNullTransformation (   $value,
bool  $valid 
)

NullTestDataProvider

Definition at line 46 of file NullTransformationTest.php.

47  {
48  if (!$valid) {
49  $this->expectException(ConstraintViolationException::class);
50  }
51  $transformed = $this->transformation->transform($value);
52  $this->assertNull($transformed);
53  }
$valid

Field Documentation

◆ $transformation

NullTransformationTest::$transformation
protected

NullTransformation.

Definition at line 19 of file NullTransformationTest.php.


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