コード例 #1
0
ファイル: StringSizeTest.php プロジェクト: ferodss/input
 public function testIsGettingErrorMessage()
 {
     $constraint = new StringSize(3);
     $this->assertFalse($constraint->validate('ab'));
     $this->assertEquals(sprintf('[field] Content out of min/max limit sizes [3, %s]', PHP_INT_MAX), $constraint->getErrorMessage('field'));
     $constraint = new StringSize(3, 5);
     $this->assertFalse($constraint->validate('ab'));
     $this->assertEquals('[field] Content out of min/max limit sizes [3, 5]', $constraint->getErrorMessage('field'));
 }
コード例 #2
0
ファイル: StringSizeTest.php プロジェクト: reisraff/input
 public function testErrorMessageIsCustomizable()
 {
     $constraint = new StringSize(1, 2, 'CUSTOM!');
     $this->assertSame('[field] CUSTOM!', $constraint->getErrorMessage('field'));
 }