本文整理汇总了PHP中Illuminate\Validation\Validator::setFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP Validator::setFiles方法的具体用法?PHP Validator::setFiles怎么用?PHP Validator::setFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Validation\Validator
的用法示例。
在下文中一共展示了Validator::setFiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setFiles
/**
* Set the files under validation.
*
* @param array $files
* @return BaseValidator
*/
public function setFiles(array $files)
{
return $this->validator->setFiles($files);
}
示例2: testValidateImage
/**
* Also covers the "Mimes" validation rule.
*/
public function testValidateImage()
{
$trans = $this->getRealTranslator();
$file = $this->getMock('Symfony\\Component\\HttpFoundation\\File\\File', array('guessExtension'), array(__FILE__, false));
$file->expects($this->any())->method('guessExtension')->will($this->returnValue('php'));
$v = new Validator($trans, array(), array('x' => 'Image'));
$v->setFiles(array('x' => $file));
$this->assertFalse($v->passes());
$v = new Validator($trans, array(), array('x' => 'Image'));
$file2 = $this->getMock('Symfony\\Component\\HttpFoundation\\File\\File', array('guessExtension'), array(__FILE__, false));
$file2->expects($this->any())->method('guessExtension')->will($this->returnValue('jpeg'));
$v->setFiles(array('x' => $file2));
$this->assertTrue($v->passes());
$file3 = $this->getMock('Symfony\\Component\\HttpFoundation\\File\\File', array('guessExtension'), array(__FILE__, false));
$file3->expects($this->any())->method('guessExtension')->will($this->returnValue('gif'));
$v->setFiles(array('x' => $file3));
$this->assertTrue($v->passes());
$file4 = $this->getMock('Symfony\\Component\\HttpFoundation\\File\\File', array('guessExtension'), array(__FILE__, false));
$file4->expects($this->any())->method('guessExtension')->will($this->returnValue('bmp'));
$v->setFiles(array('x' => $file4));
$this->assertTrue($v->passes());
$file5 = $this->getMock('Symfony\\Component\\HttpFoundation\\File\\File', array('guessExtension'), array(__FILE__, false));
$file5->expects($this->any())->method('guessExtension')->will($this->returnValue('png'));
$v->setFiles(array('x' => $file5));
$this->assertTrue($v->passes());
}