object = $this->getMockBuilder(RefundReceiptResponse::class)->getMockForAbstractClass(); $this->assertTrue(class_exists(RefundReceiptResponse::class)); $this->assertInstanceOf(RefundReceiptResponse::class, $this->object); } /** * Test property "refund_id" * @dataProvider validRefundIdDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testRefundId(mixed $value): void { $instance = $this->getTestInstance(); self::assertEmpty($instance->getRefundId()); self::assertEmpty($instance->refund_id); $instance->setRefundId($value); self::assertEquals($value, is_array($value) ? $instance->getRefundId()->toArray() : $instance->getRefundId()); self::assertEquals($value, is_array($value) ? $instance->refund_id->toArray() : $instance->refund_id); if (!empty($value)) { self::assertNotNull($instance->getRefundId()); self::assertNotNull($instance->refund_id); self::assertLessThanOrEqual(36, is_string($instance->getRefundId()) ? mb_strlen($instance->getRefundId()) : $instance->getRefundId()); self::assertLessThanOrEqual(36, is_string($instance->refund_id) ? mb_strlen($instance->refund_id) : $instance->refund_id); self::assertGreaterThanOrEqual(36, is_string($instance->getRefundId()) ? mb_strlen($instance->getRefundId()) : $instance->getRefundId()); self::assertGreaterThanOrEqual(36, is_string($instance->refund_id) ? mb_strlen($instance->refund_id) : $instance->refund_id); } } /** * Test invalid property "refund_id" * @dataProvider invalidRefundIdDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidRefundId(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setRefundId($value); } /** * @return array[] * @throws Exception */ public function validRefundIdDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_refund_id')); } /** * @return array[] * @throws Exception */ public function invalidRefundIdDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_refund_id')); } /** * @param array $options * @return void */ public function testSpecificProperties(array $options = []): void { $options = ['refund_id' => Random::str(36, 36)]; $instance = $this->getTestInstance($options); self::assertEquals($options['refund_id'], $instance->getRefundId()); } /** * @param mixed|null $options * @return RefundReceiptResponse */ protected function getTestInstance(mixed $options = null): RefundReceiptResponse { return new RefundReceiptResponse($options); } protected function addSpecificProperties(mixed $options, mixed $i): array { $array = [ Random::str(30), Random::str(40), ]; $options['refund_id'] = !$this->valid ? (Random::value($array)) : Random::value([null, '', Random::str(RefundReceiptResponse::LENGTH_REFUND_ID)]); return $options; } }