19declare(strict_types=1);
36use PHPUnit\Framework\TestCase;
37use InvalidArgumentException;
44 protected function setUp(): void
46 $language = $this->getMockBuilder(Language::class)->disableOriginalConstructor()->getMock();
47 $this->basicGroup =
new ToGroup(
new DataFactory(), $language);
52 $transformation = $this->basicGroup->int();
54 $this->assertInstanceOf(IntegerTransformation::class, $transformation);
59 $transformation = $this->basicGroup->string();
61 $this->assertInstanceOf(StringTransformation::class, $transformation);
66 $transformation = $this->basicGroup->float();
68 $this->assertInstanceOf(FloatTransformation::class, $transformation);
73 $transformation = $this->basicGroup->bool();
75 $this->assertInstanceOf(BooleanTransformation::class, $transformation);
82 $this->assertInstanceOf(ListTransformation::class, $transformation);
89 $this->assertInstanceOf(TupleTransformation::class, $transformation);
99 $this->assertInstanceOf(RecordTransformation::class, $transformation);
106 $this->assertInstanceOf(DictionaryTransformation::class, $transformation);
114 $transformation = $this->basicGroup->toNew(MyClass::class);
116 $this->assertInstanceOf(NewObjectTransformation::class, $transformation);
124 $transformation = $this->basicGroup->toNew([
new MyClass(),
'myMethod']);
126 $this->assertInstanceOf(NewMethodTransformation::class, $transformation);
131 $this->expectNotToPerformAssertions();
134 $transformation = $this->basicGroup->toNew([
new MyClass(),
'myMethod',
'hello']);
135 }
catch (InvalidArgumentException $exception) {
144 $this->expectNotToPerformAssertions();
147 $transformation = $this->basicGroup->toNew([
new MyClass()]);
148 }
catch (InvalidArgumentException $exception) {
160 $transformation = $this->basicGroup->data(
'alphanumeric');
162 $this->assertInstanceOf(NewMethodTransformation::class, $transformation);
164 $result = $transformation->transform([
'hello']);
166 $this->assertInstanceOf(Alphanumeric::class, $result);
174 return [$this->string, $this->integer];
testTupleOfTransformation()
testCreateDataTransformation()
testIsBooleanTransformationInstance()
testNewMethodTransformationThrowsExceptionBecauseToManyParametersAreGiven()
testNewMethodTransformationThrowsExceptionBecauseToFewParametersAreGiven()
testNewMethodTransformation()
testRecordOfTransformation()
testIsFloatTransformationInstance()
testDictionaryOfTransformation()
testListOfTransformation()
testIsIntegerTransformationInstance()
testIsStringTransformationInstance()
testNewObjectTransformation()