update 1.0.8.0
Commits for version update
This commit is contained in:
5
vendor/symfony/dom-crawler/Crawler.php
vendored
5
vendor/symfony/dom-crawler/Crawler.php
vendored
@@ -337,7 +337,7 @@ class Crawler implements \Countable, \IteratorAggregate
|
||||
*
|
||||
* @param int $position The position
|
||||
*
|
||||
* @return Crawler A new instance of the Crawler with the selected node, or an empty Crawler if it does not exist.
|
||||
* @return Crawler A new instance of the Crawler with the selected node, or an empty Crawler if it does not exist
|
||||
*/
|
||||
public function eq($position)
|
||||
{
|
||||
@@ -394,7 +394,7 @@ class Crawler implements \Countable, \IteratorAggregate
|
||||
*
|
||||
* @param \Closure $closure An anonymous function
|
||||
*
|
||||
* @return Crawler A Crawler instance with the selected nodes.
|
||||
* @return Crawler A Crawler instance with the selected nodes
|
||||
*/
|
||||
public function reduce(\Closure $closure)
|
||||
{
|
||||
@@ -1105,6 +1105,7 @@ class Crawler implements \Countable, \IteratorAggregate
|
||||
$crawler = new static($nodes, $this->uri, $this->baseHref);
|
||||
$crawler->isHtml = $this->isHtml;
|
||||
$crawler->document = $this->document;
|
||||
$crawler->namespaces = $this->namespaces;
|
||||
|
||||
return $crawler;
|
||||
}
|
||||
|
10
vendor/symfony/dom-crawler/Form.php
vendored
10
vendor/symfony/dom-crawler/Form.php
vendored
@@ -85,7 +85,7 @@ class Form extends Link implements \ArrayAccess
|
||||
*
|
||||
* The returned array does not include file fields (@see getFiles).
|
||||
*
|
||||
* @return array An array of field values.
|
||||
* @return array An array of field values
|
||||
*/
|
||||
public function getValues()
|
||||
{
|
||||
@@ -106,7 +106,7 @@ class Form extends Link implements \ArrayAccess
|
||||
/**
|
||||
* Gets the file field values.
|
||||
*
|
||||
* @return array An array of file field values.
|
||||
* @return array An array of file field values
|
||||
*/
|
||||
public function getFiles()
|
||||
{
|
||||
@@ -135,7 +135,7 @@ class Form extends Link implements \ArrayAccess
|
||||
* This method converts fields with the array notation
|
||||
* (like foo[bar] to arrays) like PHP does.
|
||||
*
|
||||
* @return array An array of field values.
|
||||
* @return array An array of field values
|
||||
*/
|
||||
public function getPhpValues()
|
||||
{
|
||||
@@ -162,7 +162,7 @@ class Form extends Link implements \ArrayAccess
|
||||
* For a compound file field foo[bar] it will create foo[bar][name],
|
||||
* instead of foo[name][bar] which would be found in $_FILES.
|
||||
*
|
||||
* @return array An array of file field values.
|
||||
* @return array An array of file field values
|
||||
*/
|
||||
public function getPhpFiles()
|
||||
{
|
||||
@@ -246,8 +246,6 @@ class Form extends Link implements \ArrayAccess
|
||||
* Removes a field from the form.
|
||||
*
|
||||
* @param string $name The field name
|
||||
*
|
||||
* @throws \InvalidArgumentException when the name is malformed
|
||||
*/
|
||||
public function remove($name)
|
||||
{
|
||||
|
15
vendor/symfony/dom-crawler/FormFieldRegistry.php
vendored
15
vendor/symfony/dom-crawler/FormFieldRegistry.php
vendored
@@ -26,8 +26,6 @@ class FormFieldRegistry
|
||||
* Adds a field to the registry.
|
||||
*
|
||||
* @param FormField $field The field
|
||||
*
|
||||
* @throws \InvalidArgumentException when the name is malformed
|
||||
*/
|
||||
public function add(FormField $field)
|
||||
{
|
||||
@@ -52,8 +50,6 @@ class FormFieldRegistry
|
||||
* Removes a field and its children from the registry.
|
||||
*
|
||||
* @param string $name The fully qualified name of the base field
|
||||
*
|
||||
* @throws \InvalidArgumentException when the name is malformed
|
||||
*/
|
||||
public function remove($name)
|
||||
{
|
||||
@@ -76,7 +72,6 @@ class FormFieldRegistry
|
||||
*
|
||||
* @return mixed The value of the field
|
||||
*
|
||||
* @throws \InvalidArgumentException when the name is malformed
|
||||
* @throws \InvalidArgumentException if the field does not exist
|
||||
*/
|
||||
public function &get($name)
|
||||
@@ -118,7 +113,6 @@ class FormFieldRegistry
|
||||
* @param string $name The fully qualified name of the field
|
||||
* @param mixed $value The value
|
||||
*
|
||||
* @throws \InvalidArgumentException when the name is malformed
|
||||
* @throws \InvalidArgumentException if the field does not exist
|
||||
*/
|
||||
public function set($name, $value)
|
||||
@@ -199,24 +193,23 @@ class FormFieldRegistry
|
||||
* @param string $name The name of the field
|
||||
*
|
||||
* @return string[] The list of segments
|
||||
*
|
||||
* @throws \InvalidArgumentException when the name is malformed
|
||||
*/
|
||||
private function getSegments($name)
|
||||
{
|
||||
if (preg_match('/^(?P<base>[^[]+)(?P<extra>(\[.*)|$)/', $name, $m)) {
|
||||
$segments = array($m['base']);
|
||||
while (!empty($m['extra'])) {
|
||||
if (preg_match('/^\[(?P<segment>.*?)\](?P<extra>.*)$/', $m['extra'], $m)) {
|
||||
$extra = $m['extra'];
|
||||
if (preg_match('/^\[(?P<segment>.*?)\](?P<extra>.*)$/', $extra, $m)) {
|
||||
$segments[] = $m['segment'];
|
||||
} else {
|
||||
throw new \InvalidArgumentException(sprintf('Malformed field path "%s"', $name));
|
||||
$segments[] = $extra;
|
||||
}
|
||||
}
|
||||
|
||||
return $segments;
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException(sprintf('Malformed field path "%s"', $name));
|
||||
return array($name);
|
||||
}
|
||||
}
|
||||
|
52
vendor/symfony/dom-crawler/Tests/FormTest.php
vendored
52
vendor/symfony/dom-crawler/Tests/FormTest.php
vendored
@@ -13,7 +13,6 @@ namespace Symfony\Component\DomCrawler\Tests;
|
||||
|
||||
use Symfony\Component\DomCrawler\Form;
|
||||
use Symfony\Component\DomCrawler\FormFieldRegistry;
|
||||
use Symfony\Component\DomCrawler\Field;
|
||||
|
||||
class FormTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
@@ -345,18 +344,6 @@ class FormTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function testSetValueOnMultiValuedFieldsWithMalformedName()
|
||||
{
|
||||
$form = $this->createForm('<form><input type="text" name="foo[bar]" value="bar" /><input type="text" name="foo[baz]" value="baz" /><input type="submit" /></form>');
|
||||
|
||||
try {
|
||||
$form['foo[bar'] = 'bar';
|
||||
$this->fail('->offsetSet() throws an \InvalidArgumentException exception if the name is malformed.');
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->assertTrue(true, '->offsetSet() throws an \InvalidArgumentException exception if the name is malformed.');
|
||||
}
|
||||
}
|
||||
|
||||
public function testDisableValidation()
|
||||
{
|
||||
$form = $this->createForm('<form>
|
||||
@@ -681,31 +668,19 @@ class FormTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertTrue($form->has('example.y'), '->has() returns true if the image input was correctly turned into an x and a y fields');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testFormFieldRegistryAddThrowAnExceptionWhenTheNameIsMalformed()
|
||||
public function testFormFieldRegistryAcceptAnyNames()
|
||||
{
|
||||
$registry = new FormFieldRegistry();
|
||||
$registry->add($this->getFormFieldMock('[foo]'));
|
||||
}
|
||||
$field = $this->getFormFieldMock('[t:dbt%3adate;]data_daterange_enddate_value');
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testFormFieldRegistryRemoveThrowAnExceptionWhenTheNameIsMalformed()
|
||||
{
|
||||
$registry = new FormFieldRegistry();
|
||||
$registry->remove('[foo]');
|
||||
}
|
||||
$registry->add($field);
|
||||
$this->assertEquals($field, $registry->get('[t:dbt%3adate;]data_daterange_enddate_value'));
|
||||
$registry->set('[t:dbt%3adate;]data_daterange_enddate_value', null);
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testFormFieldRegistryGetThrowAnExceptionWhenTheNameIsMalformed()
|
||||
{
|
||||
$registry = new FormFieldRegistry();
|
||||
$registry->get('[foo]');
|
||||
$form = $this->createForm('<form><input type="text" name="[t:dbt%3adate;]data_daterange_enddate_value" value="bar" /><input type="submit" /></form>');
|
||||
$form['[t:dbt%3adate;]data_daterange_enddate_value'] = 'bar';
|
||||
|
||||
$registry->remove('[t:dbt%3adate;]data_daterange_enddate_value');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -717,15 +692,6 @@ class FormTest extends \PHPUnit_Framework_TestCase
|
||||
$registry->get('foo');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testFormFieldRegistrySetThrowAnExceptionWhenTheNameIsMalformed()
|
||||
{
|
||||
$registry = new FormFieldRegistry();
|
||||
$registry->set('[foo]', null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
|
Reference in New Issue
Block a user