object = $this->getMockBuilder(SettlementPayoutRefund::class)->getMockForAbstractClass(); $this->assertTrue(class_exists(SettlementPayoutRefund::class)); $this->assertInstanceOf(SettlementPayoutRefund::class, $this->object); } /** * Test property "type" * @dataProvider validTypeDataProvider * @param mixed $value * @throws Exception */ public function testType(mixed $value): void { $instance = $this->getTestInstance(); self::assertEmpty($instance->getType()); self::assertEmpty($instance->type); $instance->setType($value); self::assertEquals($value, is_array($value) ? $instance->getType()->toArray() : $instance->getType()); self::assertEquals($value, is_array($value) ? $instance->type->toArray() : $instance->type); if (!empty($value)) { self::assertNotNull($instance->getType()); self::assertNotNull($instance->type); self::assertContains($instance->getType(), ['payout']); self::assertContains($instance->type, ['payout']); } } /** * Test invalid property "type" * @dataProvider invalidTypeDataProvider * @param mixed $value * @param string $exceptionClass * @return void */ public function testInvalidType(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setType($value); } /** * @return array[] * @throws Exception */ public function validTypeDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_type')); } /** * @return array[] * @throws Exception */ public function invalidTypeDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_type')); } /** * Test property "amount" * @dataProvider validAmountDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testAmount(mixed $value): void { $instance = $this->getTestInstance(); $instance->setAmount($value); self::assertNotNull($instance->getAmount()); self::assertNotNull($instance->amount); self::assertEquals($value, is_array($value) ? $instance->getAmount()->toArray() : $instance->getAmount()); self::assertEquals($value, is_array($value) ? $instance->amount->toArray() : $instance->amount); } /** * Test invalid property "amount" * @dataProvider invalidAmountDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidAmount(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setAmount($value); } /** * @return array[] * @throws Exception */ public function validAmountDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_amount')); } /** * @return array[] * @throws Exception */ public function invalidAmountDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_amount')); } }