ILIAS  release_8 Revision v8.23
NullTransformationTest Class Reference
+ Inheritance diagram for NullTransformationTest:
+ Collaboration diagram for NullTransformationTest:

Public Member Functions

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

Protected Member Functions

 setUp ()
 

Private Attributes

NullTransformation $transformation
 

Detailed Description

Definition at line 25 of file NullTransformationTest.php.

Member Function Documentation

◆ NullTestDataProvider()

NullTransformationTest::NullTestDataProvider ( )

Definition at line 34 of file NullTransformationTest.php.

34  : array
35  {
36  return [
37  'empty string' => ['', true],
38  'space' => [' ', true],
39  'spaces' => [' ', true],
40  'null' => [null, true],
41  'string' => ['str', false],
42  'int' => [1, false],
43  'negative int' => [-1, false],
44  'zero' => [0, false],
45  'array' => [[], false],
46  'bool (false)' => [false, false],
47  'bool (true)' => [true, false]
48  ];
49  }

◆ setUp()

NullTransformationTest::setUp ( )
protected

Definition at line 29 of file NullTransformationTest.php.

29  : void
30  {
31  $this->transformation = new NullTransformation();
32  }

◆ testNullTransformation()

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

NullTestDataProvider

Parameters
mixed$value
bool$valid
Exceptions
Exception

Definition at line 57 of file NullTransformationTest.php.

57  : void
58  {
59  if (!$valid) {
60  $this->expectException(ConstraintViolationException::class);
61  }
62  $transformed = $this->transformation->transform($value);
63  $this->assertNull($transformed);
64  }
$valid

Field Documentation

◆ $transformation

NullTransformation NullTransformationTest::$transformation
private

Definition at line 27 of file NullTransformationTest.php.


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