X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fdom-crawler%2FTests%2FFormTest.php;h=29e6ac5e2687ce8882544cb1187e5d2d819c0f4e;hb=refs%2Fheads%2Fmaster;hp=0a4cd7201e1bb8e59e30b696ba75fb8fdf6fcc47;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/symfony/dom-crawler/Tests/FormTest.php b/vendor/symfony/dom-crawler/Tests/FormTest.php index 0a4cd7201..29e6ac5e2 100644 --- a/vendor/symfony/dom-crawler/Tests/FormTest.php +++ b/vendor/symfony/dom-crawler/Tests/FormTest.php @@ -191,7 +191,7 @@ class FormTest extends TestCase $values, array_map( function ($field) { - $class = get_class($field); + $class = \get_class($field); return array(substr($class, strrpos($class, '\\') + 1), $field->getValue()); }, @@ -321,6 +321,12 @@ class FormTest extends TestCase $this->assertEquals('PATCH', $form->getMethod(), '->getMethod() returns the method defined in the constructor if provided'); } + public function testGetMethodWithOverride() + { + $form = $this->createForm('
'); + $this->assertEquals('POST', $form->getMethod(), '->getMethod() returns the method attribute value of the form'); + } + public function testGetSetValue() { $form = $this->createForm('
'); @@ -370,15 +376,15 @@ class FormTest extends TestCase { $form = $this->createForm('
'); unset($form['foo']); - $this->assertFalse(isset($form['foo']), '->offsetUnset() removes a field'); + $this->assertArrayNotHasKey('foo', $form, '->offsetUnset() removes a field'); } public function testOffsetExists() { $form = $this->createForm('
'); - $this->assertTrue(isset($form['foo']), '->offsetExists() return true if the field exists'); - $this->assertFalse(isset($form['bar']), '->offsetExists() return false if the field does not exist'); + $this->assertArrayHasKey('foo', $form, '->offsetExists() return true if the field exists'); + $this->assertArrayNotHasKey('bar', $form, '->offsetExists() return false if the field does not exist'); } public function testGetValues() @@ -456,6 +462,15 @@ class FormTest extends TestCase $form = $this->createForm('
'); $this->assertEquals(array('f.o o' => array('bar' => array('ba.z' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0), array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0)))), $form->getPhpFiles(), '->getPhpFiles() preserves periods and spaces in names recursively'); + + $form = $this->createForm('
'); + $files = $form->getPhpFiles(); + + $this->assertSame(0, $files['foo']['bar']['size'], '->getPhpFiles() converts size to int'); + $this->assertSame(4, $files['foo']['bar']['error'], '->getPhpFiles() converts error to int'); + + $form = $this->createForm('
'); + $this->assertEquals(array('size' => array('error' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0))), $form->getPhpFiles(), '->getPhpFiles() int conversion does not collide with file names'); } /** @@ -528,6 +543,12 @@ class FormTest extends TestCase $this->assertEquals('http://localhost/foo/bar', $form->getUri(), '->getUri() returns path if no action defined'); } + public function testGetUriWithActionOverride() + { + $form = $this->createForm('