object = $this->getMockBuilder(IncomeReceipt::class)->getMockForAbstractClass(); $this->assertTrue(class_exists(IncomeReceipt::class)); $this->assertInstanceOf(IncomeReceipt::class, $this->object); } /** * Test property "service_name" * @dataProvider validServiceNameDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testServiceName(mixed $value): void { $instance = $this->getTestInstance(); $instance->setServiceName($value); self::assertNotNull($instance->getServiceName()); self::assertNotNull($instance->service_name); self::assertEquals($value, is_array($value) ? $instance->getServiceName()->toArray() : $instance->getServiceName()); self::assertEquals($value, is_array($value) ? $instance->service_name->toArray() : $instance->service_name); self::assertLessThanOrEqual(50, is_string($instance->getServiceName()) ? mb_strlen($instance->getServiceName()) : $instance->getServiceName()); self::assertLessThanOrEqual(50, is_string($instance->service_name) ? mb_strlen($instance->service_name) : $instance->service_name); self::assertGreaterThanOrEqual(1, is_string($instance->getServiceName()) ? mb_strlen($instance->getServiceName()) : $instance->getServiceName()); self::assertGreaterThanOrEqual(1, is_string($instance->service_name) ? mb_strlen($instance->service_name) : $instance->service_name); } /** * Test invalid property "service_name" * @dataProvider invalidServiceNameDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidServiceName(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setServiceName($value); } /** * @return array[] * @throws Exception */ public function validServiceNameDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_service_name')); } /** * @return array[] * @throws Exception */ public function invalidServiceNameDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_service_name')); } /** * Test property "npd_receipt_id" * @dataProvider validNpdReceiptIdDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testNpdReceiptId(mixed $value): void { $instance = $this->getTestInstance(); self::assertEmpty($instance->getNpdReceiptId()); self::assertEmpty($instance->npd_receipt_id); $instance->setNpdReceiptId($value); self::assertEquals($value, is_array($value) ? $instance->getNpdReceiptId()->toArray() : $instance->getNpdReceiptId()); self::assertEquals($value, is_array($value) ? $instance->npd_receipt_id->toArray() : $instance->npd_receipt_id); if (!empty($value)) { self::assertNotNull($instance->getNpdReceiptId()); self::assertNotNull($instance->npd_receipt_id); } } /** * Test invalid property "npd_receipt_id" * @dataProvider invalidNpdReceiptIdDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidNpdReceiptId(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setNpdReceiptId($value); } /** * @return array[] * @throws Exception */ public function validNpdReceiptIdDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_npd_receipt_id')); } /** * @return array[] * @throws Exception */ public function invalidNpdReceiptIdDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_npd_receipt_id')); } /** * Test property "url" * @dataProvider validUrlDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testUrl(mixed $value): void { $instance = $this->getTestInstance(); self::assertEmpty($instance->getUrl()); self::assertEmpty($instance->url); $instance->setUrl($value); self::assertEquals($value, is_array($value) ? $instance->getUrl()->toArray() : $instance->getUrl()); self::assertEquals($value, is_array($value) ? $instance->url->toArray() : $instance->url); if (!empty($value)) { self::assertNotNull($instance->getUrl()); self::assertNotNull($instance->url); } } /** * Test invalid property "url" * @dataProvider invalidUrlDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidUrl(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setUrl($value); } /** * @return array[] * @throws Exception */ public function validUrlDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_url')); } /** * @return array[] * @throws Exception */ public function invalidUrlDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_url')); } /** * Test property "amount" * @dataProvider validAmountDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testAmount(mixed $value): void { $instance = $this->getTestInstance(); self::assertEmpty($instance->getAmount()); self::assertEmpty($instance->amount); $instance->setAmount($value); self::assertEquals($value, is_array($value) ? $instance->getAmount()->toArray() : $instance->getAmount()); self::assertEquals($value, is_array($value) ? $instance->amount->toArray() : $instance->amount); if (!empty($value)) { self::assertNotNull($instance->getAmount()); self::assertNotNull($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')); } }