示例#1
0
文件: LengthTest.php 项目: seytar/psx
 public function testFilterStringLength()
 {
     $filter = new Length(3, 8);
     $this->assertEquals(false, $filter->apply('fo'));
     $this->assertEquals(true, $filter->apply('foo'));
     $this->assertEquals(true, $filter->apply('foobarte'));
     $this->assertEquals(false, $filter->apply('foobartes'));
     // test error message
     $this->assertErrorMessage($filter->getErrorMessage());
     $filter = new Length(8);
     $this->assertEquals(true, $filter->apply('fo'));
     $this->assertEquals(true, $filter->apply('foo'));
     $this->assertEquals(true, $filter->apply('foobarte'));
     $this->assertEquals(false, $filter->apply('foobartes'));
     // test error message
     $this->assertErrorMessage($filter->getErrorMessage());
 }