addSupportedBrand() public method

Note: The fact that a particular card is known does not imply that your gateway supports it. Set $add_to_front to true if the key should be added to the front of the array
public addSupportedBrand ( string $name, string $expression ) : boolean
$name string The name of the new supported brand.
$expression string The regular expression to check if a card is supported.
return boolean success
Ejemplo n.º 1
0
 public function testCustomBrandWorks()
 {
     $this->card->addSupportedBrand('omniexpress', '/^9\\d{12}(\\d{3})?$/');
     $this->assertArrayHasKey('omniexpress', $this->card->getSupportedBrands());
     $this->card->setNumber('9111111111111110');
     $this->card->validate();
     $this->assertEquals('omniexpress', $this->card->getBrand());
 }
Ejemplo n.º 2
0
 public function testCustomBrandAddedTwiceReturnsFalse()
 {
     $this->assertTrue($this->card->addSupportedBrand('omniexpress', '/^9\\d{12}(\\d{3})?$/'));
     $this->assertArrayHasKey('omniexpress', $this->card->getSupportedBrands());
     $this->assertFalse($this->card->addSupportedBrand('omniexpress', '/^9\\d{12}(\\d{3})?$/'));
 }