object = $this->getMockBuilder(SavePaymentMethodSbpPayerBankDetails::class)->getMockForAbstractClass(); $this->assertTrue(class_exists(SavePaymentMethodSbpPayerBankDetails::class)); $this->assertInstanceOf(SavePaymentMethodSbpPayerBankDetails::class, $this->object); } /** * Test property "bank_id" * @dataProvider validBankIdDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testBankId(mixed $value): void { $instance = $this->getTestInstance(); $instance->setBankId($value); self::assertNotNull($instance->getBankId()); self::assertNotNull($instance->bank_id); self::assertEquals($value, is_array($value) ? $instance->getBankId()->toArray() : $instance->getBankId()); self::assertEquals($value, is_array($value) ? $instance->bank_id->toArray() : $instance->bank_id); self::assertMatchesRegularExpression("/[a-zA-Z0-9]{12}/", $instance->getBankId()); self::assertMatchesRegularExpression("/[a-zA-Z0-9]{12}/", $instance->bank_id); self::assertLessThanOrEqual(12, is_string($instance->getBankId()) ? mb_strlen($instance->getBankId()) : $instance->getBankId()); self::assertLessThanOrEqual(12, is_string($instance->bank_id) ? mb_strlen($instance->bank_id) : $instance->bank_id); } /** * Test invalid property "bank_id" * @dataProvider invalidBankIdDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidBankId(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setBankId($value); } /** * @return array[] * @throws Exception */ public function validBankIdDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_bank_id')); } /** * @return array[] * @throws Exception */ public function invalidBankIdDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_bank_id')); } }