object = $this->getMockBuilder(PayoutsRequest::class)->getMockForAbstractClass(); $this->assertTrue(class_exists(PayoutsRequest::class)); $this->assertInstanceOf(PayoutsRequest::class, $this->object); self::assertTrue($this->object->validate()); } /** * Test property "cursor" * @dataProvider validCursorDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testCursor(mixed $value): void { $instance = $this->getTestInstance(); self::assertEmpty($instance->getCursor()); self::assertEmpty($instance->cursor); $instance->setCursor($value); self::assertEquals($value, $instance->getCursor()); self::assertEquals($value, $instance->cursor); if (!empty($value)) { self::assertTrue($instance->hasCursor()); self::assertNotNull($instance->getCursor()); self::assertNotNull($instance->cursor); } } /** * Test invalid property "cursor" * @dataProvider invalidCursorDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidCursor(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setCursor($value); } /** * @return array[] * @throws Exception */ public function validCursorDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_cursor')); } /** * @return array[] * @throws Exception */ public function invalidCursorDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_cursor')); } /** * Test property "limit" * @dataProvider validLimitDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testLimit(mixed $value): void { $instance = $this->getTestInstance(); $instance->setLimit($value); self::assertEquals($value, $instance->getLimit()); self::assertEquals($value, $instance->limit); if (!empty($value)) { self::assertTrue($instance->hasLimit()); self::assertNotNull($instance->getLimit()); self::assertNotNull($instance->limit); self::assertLessThanOrEqual(100, is_string($instance->getLimit()) ? mb_strlen($instance->getLimit()) : $instance->getLimit()); self::assertLessThanOrEqual(100, is_string($instance->limit) ? mb_strlen($instance->limit) : $instance->limit); self::assertGreaterThanOrEqual(1, is_string($instance->getLimit()) ? mb_strlen($instance->getLimit()) : $instance->getLimit()); self::assertGreaterThanOrEqual(1, is_string($instance->limit) ? mb_strlen($instance->limit) : $instance->limit); self::assertIsNumeric($instance->getLimit()); self::assertIsNumeric($instance->limit); } } /** * Test invalid property "limit" * @dataProvider invalidCursorDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidLimit(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setCursor($value); } /** * @return array[] * @throws Exception */ public function validLimitDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_limit')); } /** * @return array[] * @throws Exception */ public function invalidLimitDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_limit')); } /** * Test property "created_at_gte" * @dataProvider validCreatedAtGteDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testCreatedAtGte(mixed $value): void { $instance = $this->getTestInstance(); self::assertEmpty($instance->getCreatedAtGte()); self::assertEmpty($instance->created_at_gte); $instance->setCreatedAtGte($value); if (!empty($value)) { self::assertTrue($instance->hasCreatedAtGte()); self::assertNotNull($instance->getCreatedAtGte()); self::assertNotNull($instance->created_at_gte); if ($value instanceof Datetime) { self::assertEquals($value, $instance->getCreatedAtGte()); self::assertEquals($value, $instance->created_at_gte); } else { self::assertEquals(new Datetime($value), $instance->getCreatedAtGte()); self::assertEquals(new Datetime($value), $instance->created_at_gte); } } } /** * Test invalid property "created_at_gte" * @dataProvider invalidCreatedAtGteDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidCreatedAtGte(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setCreatedAtGte($value); } /** * @return array[] * @throws Exception */ public function validCreatedAtGteDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_created_at_gte')); } /** * @return array[] * @throws Exception */ public function invalidCreatedAtGteDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_created_at_gte')); } /** * Test property "created_at_gt" * @dataProvider validCreatedAtGtDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testCreatedAtGt(mixed $value): void { $instance = $this->getTestInstance(); self::assertEmpty($instance->getCreatedAtGt()); self::assertEmpty($instance->created_at_gt); $instance->setCreatedAtGt($value); if (!empty($value)) { self::assertTrue($instance->hasCreatedAtGt()); self::assertNotNull($instance->getCreatedAtGt()); self::assertNotNull($instance->created_at_gt); if ($value instanceof Datetime) { self::assertEquals($value, $instance->getCreatedAtGt()); self::assertEquals($value, $instance->created_at_gt); } else { self::assertEquals(new Datetime($value), $instance->getCreatedAtGt()); self::assertEquals(new Datetime($value), $instance->created_at_gt); } } } /** * Test invalid property "created_at_gt" * @dataProvider invalidCreatedAtGtDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidCreatedAtGt(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setCreatedAtGt($value); } /** * @return array[] * @throws Exception */ public function validCreatedAtGtDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_created_at_gt')); } /** * @return array[] * @throws Exception */ public function invalidCreatedAtGtDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_created_at_gt')); } /** * Test property "created_at_lte" * @dataProvider validCreatedAtLteDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testCreatedAtLte(mixed $value): void { $instance = $this->getTestInstance(); self::assertEmpty($instance->getCreatedAtLte()); self::assertEmpty($instance->created_at_lte); $instance->setCreatedAtLte($value); if (!empty($value)) { self::assertTrue($instance->hasCreatedAtLte()); self::assertNotNull($instance->getCreatedAtLte()); self::assertNotNull($instance->created_at_lte); if ($value instanceof Datetime) { self::assertEquals($value, $instance->getCreatedAtLte()); self::assertEquals($value, $instance->created_at_lte); } else { self::assertEquals(new Datetime($value), $instance->getCreatedAtLte()); self::assertEquals(new Datetime($value), $instance->created_at_lte); } } } /** * Test invalid property "created_at_lte" * @dataProvider invalidCreatedAtLteDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidCreatedAtLte(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setCreatedAtLte($value); } /** * @return array[] * @throws Exception */ public function validCreatedAtLteDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_created_at_lte')); } /** * @return array[] * @throws Exception */ public function invalidCreatedAtLteDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_created_at_lte')); } /** * Test property "created_at_lt" * @dataProvider validCreatedAtLtDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testCreatedAtLt(mixed $value): void { $instance = $this->getTestInstance(); self::assertEmpty($instance->getCreatedAtLt()); self::assertEmpty($instance->created_at_lt); $instance->setCreatedAtLt($value); if (!empty($value)) { self::assertTrue($instance->hasCreatedAtLt()); self::assertNotNull($instance->getCreatedAtLt()); self::assertNotNull($instance->created_at_lt); if ($value instanceof Datetime) { self::assertEquals($value, $instance->getCreatedAtLt()); self::assertEquals($value, $instance->created_at_lt); } else { self::assertEquals(new Datetime($value), $instance->getCreatedAtLt()); self::assertEquals(new Datetime($value), $instance->created_at_lt); } } } /** * Test invalid property "created_at_lt" * @dataProvider invalidCreatedAtLtDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidCreatedAtLt(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setCreatedAtLt($value); } /** * @return array[] * @throws Exception */ public function validCreatedAtLtDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_created_at_lt')); } /** * @return array[] * @throws Exception */ public function invalidCreatedAtLtDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_created_at_lt')); } /** * Test property "payout_destination_type" * @dataProvider validPayoutDestinationTypeDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testPayoutDestinationType(mixed $value): void { $instance = $this->getTestInstance(); self::assertEmpty($instance->getPayoutDestinationType()); self::assertEmpty($instance->payout_destination_type); self::assertEmpty($instance->payoutDestinationType); $instance->setPayoutDestinationType($value); self::assertEquals($value, $instance->getPayoutDestinationType()); self::assertEquals($value, $instance->payout_destination_type); self::assertEquals($value, $instance->payoutDestinationType); if (!empty($value)) { self::assertTrue($instance->hasPayoutDestinationType()); self::assertNotNull($instance->getPayoutDestinationType()); self::assertNotNull($instance->payout_destination_type); self::assertNotNull($instance->payoutDestinationType); } } /** * Test invalid property "payout_destination_type" * @dataProvider invalidPayoutDestinationTypeDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidPayoutDestinationType(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setPayoutDestinationType($value); } /** * @return array[] * @throws Exception */ public function validPayoutDestinationTypeDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_payout_destination_type')); } /** * @return array[] * @throws Exception */ public function invalidPayoutDestinationTypeDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_payout_destination_type')); } /** * Test property "status" * @dataProvider validStatusDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testStatus(mixed $value): void { $instance = $this->getTestInstance(); self::assertEmpty($instance->getStatus()); self::assertEmpty($instance->status); $instance->setStatus($value); if (!empty($value)) { self::assertTrue($instance->hasStatus()); self::assertNotNull($instance->getStatus()); self::assertNotNull($instance->status); self::assertEquals($value, $instance->getStatus()); self::assertEquals($value, $instance->status); self::assertContains($instance->getStatus(), ['pending', 'succeeded', 'canceled']); self::assertContains($instance->status, ['pending', 'succeeded', 'canceled']); } } /** * Test invalid property "status" * @dataProvider invalidStatusDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidStatus(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setStatus($value); } /** * @return array[] * @throws Exception */ public function validStatusDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_status')); } /** * @return array[] * @throws Exception */ public function invalidStatusDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_status')); } /** * Test valid method "builder" * @dataProvider validClassDataProvider * @param mixed $value * * @return void */ public function testBuilder(mixed $value): void { $instance = $this->getTestInstance($value); self::assertInstanceOf(AbstractRequestBuilder::class, $instance::builder()); } /** * @return array * @throws Exception */ public function validClassDataProvider(): array { $instance = $this->getTestInstance(); return [$this->getValidDataProviderByClass($instance)]; } }