object = $this->getMockBuilder(IncomeReceiptData::class)->getMockForAbstractClass(); $this->assertTrue(class_exists(IncomeReceiptData::class)); $this->assertInstanceOf(IncomeReceiptData::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 "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')); } }