Beispiel #1
0
 /**
  * @covers \Straw\Rule\Regex::makePart
  * @test
  */
 public function makePart()
 {
     $method = $this->reflectionMethod('makePart');
     $input = array('alpha' => 'alpha', 'alnum' => 'al2', 'number' => 1, 'original' => 'original', 'original_list' => 'value,value');
     $s = Straw::open($input);
     $alpha = $s->alpha('alpha');
     $this->assertEquals('[a-zA-Z_]{1,}', $method->invokeArgs($this->object, array($alpha)));
     $alnum = $s->alnum('alnum');
     $this->assertEquals('[a-zA-Z0-9_]{1,}', $method->invokeArgs($this->object, array($alnum)));
     $number = $s->number('number');
     $this->assertEquals('[0-9]{1,}', $method->invokeArgs($this->object, array($number)));
     $original_normal = $s->original('original', null, 'abc-_');
     $this->assertEquals('abc-_', $method->invokeArgs($this->object, array($original_normal)));
     $original_list = $s->originalList('original_list', null, 'abc-_');
     $this->assertEquals('[abc-_]{1,}', $method->invokeArgs($this->object, array($original_list)));
 }
Beispiel #2
0
 /**
  * @covers Straw\Straw::open
  * @test
  */
 public function インスタンスの生成()
 {
     $straw = Straw::open();
     $this->assertInstanceOf('Straw\\Straw', $straw);
 }