object = $this->getMockBuilder(PersonalDataCancellationDetails::class)->getMockForAbstractClass(); $this->assertTrue(class_exists(PersonalDataCancellationDetails::class)); $this->assertInstanceOf(PersonalDataCancellationDetails::class, $this->object); } /** * Test property "party" * @dataProvider validPartyDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testParty(mixed $value): void { $instance = $this->getTestInstance(); $instance->setParty($value); self::assertNotNull($instance->getParty()); self::assertNotNull($instance->party); self::assertEquals($value, is_array($value) ? $instance->getParty()->toArray() : $instance->getParty()); self::assertEquals($value, is_array($value) ? $instance->party->toArray() : $instance->party); self::assertContains($instance->getParty(), ['yoo_money']); self::assertContains($instance->party, ['yoo_money']); } /** * Test invalid property "party" * @dataProvider invalidPartyDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidParty(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setParty($value); } /** * @return array[] * @throws Exception */ public function validPartyDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_party')); } /** * @return array[] * @throws Exception */ public function invalidPartyDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_party')); } /** * Test property "reason" * @dataProvider validReasonDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testReason(mixed $value): void { $instance = $this->getTestInstance(); $instance->setReason($value); self::assertNotNull($instance->getReason()); self::assertNotNull($instance->reason); self::assertEquals($value, is_array($value) ? $instance->getReason()->toArray() : $instance->getReason()); self::assertEquals($value, is_array($value) ? $instance->reason->toArray() : $instance->reason); self::assertContains($instance->getReason(), ['expired_by_timeout']); self::assertContains($instance->reason, ['expired_by_timeout']); } /** * Test invalid property "reason" * @dataProvider invalidReasonDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidReason(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setReason($value); } /** * @return array[] * @throws Exception */ public function validReasonDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_reason')); } /** * @return array[] * @throws Exception */ public function invalidReasonDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_reason')); } }