예제 #1
0
 public function testConstructorSetIDZeros()
 {
     $id = new ID(0);
     $key = new Key($id);
     $this->assertSame('000000', $key->getKey());
     $this->assertSame('0', $key->getPrefix());
     $this->assertSame('000000', (string) $key);
 }
예제 #2
0
 public function testValidZeros()
 {
     $string = '000000';
     $key = new Key($string);
     $this->assertSame($string, $key->getKey());
     $string = 'B00000';
     $key = new Key($string);
     $this->assertSame($string, $key->getKey());
     // many zeros
     $string = '000000000000';
     $key = new Key($string);
     $this->assertSame($string, $key->getKey());
     // leading zeros
     $string = 'B00002';
     $key = new Key($string);
     $this->assertSame($string, $key->getKey());
     $this->assertSame('B', $key->getPrefix());
 }
예제 #3
0
 /**
  * @dataProvider providerOfIds
  */
 public function testIdToKey($id, $prefix, $expectedKey)
 {
     $id = new ID($id);
     $key = new Key($id, $prefix);
     $this->assertSame($expectedKey, $key->getKey());
 }