object = $this->getMockBuilder(ReceiverDigitalWallet::class)->getMockForAbstractClass(); $this->assertTrue(class_exists(ReceiverDigitalWallet::class)); $this->assertInstanceOf(ReceiverDigitalWallet::class, $this->object); } /** * Test property "type" * @dataProvider validTypeDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testType(mixed $value): void { $instance = $this->getTestInstance(); self::assertNotNull($instance->getType()); self::assertNotNull($instance->type); self::assertContains($instance->getType(), ['digital_wallet']); self::assertContains($instance->type, ['digital_wallet']); } /** * 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 "account_number" * @dataProvider validAccountNumberDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testAccountNumber(mixed $value): void { $instance = $this->getTestInstance(); $instance->setAccountNumber($value); self::assertNotNull($instance->getAccountNumber()); self::assertNotNull($instance->account_number); self::assertEquals($value, $instance->getAccountNumber()); self::assertEquals($value, $instance->account_number); self::assertLessThanOrEqual(20, is_string($instance->getAccountNumber()) ? mb_strlen($instance->getAccountNumber()) : $instance->getAccountNumber()); self::assertLessThanOrEqual(20, is_string($instance->account_number) ? mb_strlen($instance->account_number) : $instance->account_number); } /** * Test invalid property "account_number" * @dataProvider invalidAccountNumberDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidAccountNumber(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setAccountNumber($value); } /** * @return array[] * @throws Exception */ public function validAccountNumberDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_account_number')); } /** * @return array[] * @throws Exception */ public function invalidAccountNumberDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_account_number')); } }