object = $this->getMockBuilder(MerchantCustomerBankAccount::class)->getMockForAbstractClass(); $this->assertTrue(class_exists(MerchantCustomerBankAccount::class)); $this->assertInstanceOf(MerchantCustomerBankAccount::class, $this->object); } /** * Test property "account_number" * @dataProvider validAccountNumberDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testAccountNumber(mixed $value): void { $instance = $this->getTestInstance(); self::assertEmpty($instance->getAccountNumber()); self::assertEmpty($instance->account_number); $instance->setAccountNumber($value); self::assertEquals($value, is_array($value) ? $instance->getAccountNumber()->toArray() : $instance->getAccountNumber()); self::assertEquals($value, is_array($value) ? $instance->account_number->toArray() : $instance->account_number); if (!empty($value)) { self::assertNotNull($instance->getAccountNumber()); self::assertNotNull($instance->account_number); self::assertMatchesRegularExpression("/[0-9]{20}/", $instance->getAccountNumber()); self::assertMatchesRegularExpression("/[0-9]{20}/", $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')); } /** * Test property "bic" * @dataProvider validBicDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testBic(mixed $value): void { $instance = $this->getTestInstance(); self::assertEmpty($instance->getBic()); self::assertEmpty($instance->bic); $instance->setBic($value); self::assertEquals($value, is_array($value) ? $instance->getBic()->toArray() : $instance->getBic()); self::assertEquals($value, is_array($value) ? $instance->bic->toArray() : $instance->bic); if (!empty($value)) { self::assertNotNull($instance->getBic()); self::assertNotNull($instance->bic); self::assertMatchesRegularExpression("/\\d{9}/", $instance->getBic()); self::assertMatchesRegularExpression("/\\d{9}/", $instance->bic); } } /** * Test invalid property "bic" * @dataProvider invalidBicDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidBic(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setBic($value); } /** * @return array[] * @throws Exception */ public function validBicDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_bic')); } /** * @return array[] * @throws Exception */ public function invalidBicDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_bic')); } }