object = $this->getMockBuilder(PaymentDataApplePay::class)->getMockForAbstractClass(); $this->assertTrue(class_exists(PaymentDataApplePay::class)); $this->assertInstanceOf(PaymentDataApplePay::class, $this->object); } /** * Test property "payment_data" * @dataProvider validPaymentDataDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testPaymentData(mixed $value): void { $instance = $this->getTestInstance(); self::assertEmpty($instance->getPaymentData()); self::assertEmpty($instance->payment_data); $instance->setPaymentData($value); self::assertEquals($value, is_array($value) ? $instance->getPaymentData()->toArray() : $instance->getPaymentData()); self::assertEquals($value, is_array($value) ? $instance->payment_data->toArray() : $instance->payment_data); if (!empty($value)) { self::assertNotNull($instance->getPaymentData()); self::assertNotNull($instance->payment_data); } } /** * Test invalid property "payment_data" * @dataProvider invalidPaymentDataDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidPaymentData(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setPaymentData($value); } /** * @return array[] * @throws Exception */ public function validPaymentDataDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_payment_data')); } /** * @return array[] * @throws Exception */ public function invalidPaymentDataDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_payment_data')); } }