PATH:
opt
/
alt
/
php54
/
usr
/
share
/
pear
/
test
/
Form
/
Symfony
/
Component
/
Form
/
Tests
/
Extension
/
Core
/
Type
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; class FileTypeTest extends \Symfony\Component\Form\Test\TypeTestCase { // https://github.com/symfony/symfony/pull/5028 public function testSetData() { $form = $this->factory->createBuilder('file')->getForm(); $data = $this->createUploadedFileMock('abcdef', 'original.jpg', true); $form->setData($data); $this->assertSame($data, $form->getData()); } public function testSubmit() { $form = $this->factory->createBuilder('file')->getForm(); $data = $this->createUploadedFileMock('abcdef', 'original.jpg', true); $form->submit($data); $this->assertSame($data, $form->getData()); } // https://github.com/symfony/symfony/issues/6134 public function testSubmitEmpty() { $form = $this->factory->createBuilder('file')->getForm(); $form->submit(null); $this->assertNull($form->getData()); } public function testDontPassValueToView() { $form = $this->factory->create('file'); $form->submit(array( 'file' => $this->createUploadedFileMock('abcdef', 'original.jpg', true), )); $view = $form->createView(); $this->assertEquals('', $view->vars['value']); } private function createUploadedFileMock($name, $originalName, $valid) { $file = $this ->getMockBuilder('Symfony\Component\HttpFoundation\File\UploadedFile') ->disableOriginalConstructor() ->getMock() ; $file ->expects($this->any()) ->method('getBasename') ->will($this->returnValue($name)) ; $file ->expects($this->any()) ->method('getClientOriginalName') ->will($this->returnValue($originalName)) ; $file ->expects($this->any()) ->method('isValid') ->will($this->returnValue($valid)) ; return $file; } }
[-] NumberTypeTest.php
[edit]
[-] LanguageTypeTest.php
[edit]
[-] IntegerTypeTest.php
[edit]
[-] UrlTypeTest.php
[edit]
[-] TimeTypeTest.php
[edit]
[-] LocaleTypeTest.php
[edit]
[-] FileTypeTest.php
[edit]
[-] SubmitTypeTest.php
[edit]
[-] CollectionTypeTest.php
[edit]
[-] TimezoneTypeTest.php
[edit]
[-] RepeatedTypeTest.php
[edit]
[-] TypeTestCase.php
[edit]
[-] ChoiceTypePerformanceTest.php
[edit]
[-] CurrencyTypeTest.php
[edit]
[-] CheckboxTypeTest.php
[edit]
[-] ButtonTypeTest.php
[edit]
[-] PasswordTypeTest.php
[edit]
[-] DateTypeTest.php
[edit]
[-] MoneyTypeTest.php
[edit]
[-] DateTimeTypeTest.php
[edit]
[+]
..
[-] CountryTypeTest.php
[edit]
[-] FormTypeTest.php
[edit]
[-] ChoiceTypeTest.php
[edit]
[-] BaseTypeTest.php
[edit]