Skip to content

Commit 66b39ee

Browse files
committed
fixed CS
1 parent 4105e02 commit 66b39ee

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

Tests/CrawlerTest.php

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testAdd()
5252
$crawler->add($this->createNodeList());
5353
$this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->add() adds nodes from a \DOMNodeList');
5454

55-
$list = array();
55+
$list = [];
5656
foreach ($this->createNodeList() as $node) {
5757
$list[] = $node;
5858
}
@@ -269,7 +269,7 @@ public function testAddNodeList()
269269

270270
public function testAddNodes()
271271
{
272-
$list = array();
272+
$list = [];
273273
foreach ($this->createNodeList() as $node) {
274274
$list[] = $node;
275275
}
@@ -314,7 +314,7 @@ public function testEach()
314314
return $i.'-'.$node->text();
315315
});
316316

317-
$this->assertEquals(array('0-One', '1-Two', '2-Three'), $data, '->each() executes an anonymous function on each node of the list');
317+
$this->assertEquals(['0-One', '1-Two', '2-Three'], $data, '->each() executes an anonymous function on each node of the list');
318318
}
319319

320320
public function testIteration()
@@ -415,13 +415,13 @@ public function testExtract()
415415
{
416416
$crawler = $this->createTestCrawler()->filterXPath('//ul[1]/li');
417417

418-
$this->assertEquals(array('One', 'Two', 'Three'), $crawler->extract('_text'), '->extract() returns an array of extracted data from the node list');
419-
$this->assertEquals(array(array('One', 'first'), array('Two', ''), array('Three', '')), $crawler->extract(array('_text', 'class')), '->extract() returns an array of extracted data from the node list');
420-
$this->assertEquals(array(array(), array(), array()), $crawler->extract(array()), '->extract() returns empty arrays if the attribute list is empty');
418+
$this->assertEquals(['One', 'Two', 'Three'], $crawler->extract('_text'), '->extract() returns an array of extracted data from the node list');
419+
$this->assertEquals([['One', 'first'], ['Two', ''], ['Three', '']], $crawler->extract(['_text', 'class']), '->extract() returns an array of extracted data from the node list');
420+
$this->assertEquals([[], [], []], $crawler->extract([]), '->extract() returns empty arrays if the attribute list is empty');
421421

422-
$this->assertEquals(array(), $this->createTestCrawler()->filterXPath('//ol')->extract('_text'), '->extract() returns an empty array if the node list is empty');
422+
$this->assertEquals([], $this->createTestCrawler()->filterXPath('//ol')->extract('_text'), '->extract() returns an empty array if the node list is empty');
423423

424-
$this->assertEquals(array(array('One', 'li'), array('Two', 'li'), array('Three', 'li')), $crawler->extract(array('_text', '_name')), '->extract() returns an array of extracted data from the node list');
424+
$this->assertEquals([['One', 'li'], ['Two', 'li'], ['Three', 'li']], $crawler->extract(['_text', '_name']), '->extract() returns an array of extracted data from the node list');
425425
}
426426

427427
public function testFilterXpathComplexQueries()
@@ -855,7 +855,7 @@ public function testLinks()
855855
$links = $crawler->links();
856856
$this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Link', $links[0], '->links() returns an array of Link instances');
857857

858-
$this->assertEquals(array(), $this->createTestCrawler()->filterXPath('//ol')->links(), '->links() returns an empty array if the node selection is empty');
858+
$this->assertEquals([], $this->createTestCrawler()->filterXPath('//ol')->links(), '->links() returns an empty array if the node selection is empty');
859859
}
860860

861861
public function testImages()
@@ -867,7 +867,7 @@ public function testImages()
867867
$images = $crawler->images();
868868
$this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Image', $images[0], '->images() returns an array of Image instances');
869869

870-
$this->assertEquals(array(), $this->createTestCrawler()->filterXPath('//ol')->links(), '->links() returns an empty array if the node selection is empty');
870+
$this->assertEquals([], $this->createTestCrawler()->filterXPath('//ol')->links(), '->links() returns an empty array if the node selection is empty');
871871
}
872872

873873
public function testForm()
@@ -880,9 +880,9 @@ public function testForm()
880880

881881
$this->assertEquals($crawler->form()->getFormNode()->getAttribute('id'), $crawler2->form()->getFormNode()->getAttribute('id'), '->form() works on elements with form attribute');
882882

883-
$this->assertEquals(array('FooName' => 'FooBar', 'TextName' => 'TextValue', 'FooTextName' => 'FooTextValue'), $crawler->form(array('FooName' => 'FooBar'))->getValues(), '->form() takes an array of values to submit as its first argument');
884-
$this->assertEquals(array('FooName' => 'FooValue', 'TextName' => 'TextValue', 'FooTextName' => 'FooTextValue'), $crawler->form()->getValues(), '->getValues() returns correct form values');
885-
$this->assertEquals(array('FooBarName' => 'FooBarValue', 'TextName' => 'TextValue', 'FooTextName' => 'FooTextValue'), $crawler2->form()->getValues(), '->getValues() returns correct form values');
883+
$this->assertEquals(['FooName' => 'FooBar', 'TextName' => 'TextValue', 'FooTextName' => 'FooTextValue'], $crawler->form(['FooName' => 'FooBar'])->getValues(), '->form() takes an array of values to submit as its first argument');
884+
$this->assertEquals(['FooName' => 'FooValue', 'TextName' => 'TextValue', 'FooTextName' => 'FooTextValue'], $crawler->form()->getValues(), '->getValues() returns correct form values');
885+
$this->assertEquals(['FooBarName' => 'FooBarValue', 'TextName' => 'TextValue', 'FooTextName' => 'FooTextValue'], $crawler2->form()->getValues(), '->getValues() returns correct form values');
886886

887887
try {
888888
$this->createTestCrawler()->filterXPath('//ol')->form();
@@ -1072,13 +1072,13 @@ public function testBaseTag($baseValue, $linkValue, $expectedUri, $currentUri =
10721072

10731073
public function getBaseTagData()
10741074
{
1075-
return array(
1076-
array('http://base.com', 'link', 'http://base.com/link'),
1077-
array('//base.com', 'link', 'https://base.com/link', 'https://domain.com', '<base> tag can use a schema-less URL'),
1078-
array('path/', 'link', 'https://domain.com/path/link', 'https://domain.com', '<base> tag can set a path'),
1079-
array('http://base.com', '#', 'http://base.com#', 'http://domain.com/path/link', '<base> tag does work with links to an anchor'),
1080-
array('http://base.com', '', 'http://base.com', 'http://domain.com/path/link', '<base> tag does work with empty links'),
1081-
);
1075+
return [
1076+
['http://base.com', 'link', 'http://base.com/link'],
1077+
['//base.com', 'link', 'https://base.com/link', 'https://domain.com', '<base> tag can use a schema-less URL'],
1078+
['path/', 'link', 'https://domain.com/path/link', 'https://domain.com', '<base> tag can set a path'],
1079+
['http://base.com', '#', 'http://base.com#', 'http://domain.com/path/link', '<base> tag does work with links to an anchor'],
1080+
['http://base.com', '', 'http://base.com', 'http://domain.com/path/link', '<base> tag does work with empty links'],
1081+
];
10821082
}
10831083

10841084
/**
@@ -1092,14 +1092,14 @@ public function testBaseTagWithForm($baseValue, $actionValue, $expectedUri, $cur
10921092

10931093
public function getBaseTagWithFormData()
10941094
{
1095-
return array(
1096-
array('https://base.com/', 'link/', 'https://base.com/link/', 'https://base.com/link/', '<base> tag does work with a path and relative form action'),
1097-
array('/basepath', '/registration', 'http://domain.com/registration', 'http://domain.com/registration', '<base> tag does work with a path and form action'),
1098-
array('/basepath', '', 'http://domain.com/registration', 'http://domain.com/registration', '<base> tag does work with a path and empty form action'),
1099-
array('http://base.com/', '/registration', 'http://base.com/registration', 'http://domain.com/registration', '<base> tag does work with a URL and form action'),
1100-
array('http://base.com', '', 'http://domain.com/path/form', 'http://domain.com/path/form', '<base> tag does work with a URL and an empty form action'),
1101-
array('http://base.com/path', '/registration', 'http://base.com/registration', 'http://domain.com/path/form', '<base> tag does work with a URL and form action'),
1102-
);
1095+
return [
1096+
['https://base.com/', 'link/', 'https://base.com/link/', 'https://base.com/link/', '<base> tag does work with a path and relative form action'],
1097+
['/basepath', '/registration', 'http://domain.com/registration', 'http://domain.com/registration', '<base> tag does work with a path and form action'],
1098+
['/basepath', '', 'http://domain.com/registration', 'http://domain.com/registration', '<base> tag does work with a path and empty form action'],
1099+
['http://base.com/', '/registration', 'http://base.com/registration', 'http://domain.com/registration', '<base> tag does work with a URL and form action'],
1100+
['http://base.com', '', 'http://domain.com/path/form', 'http://domain.com/path/form', '<base> tag does work with a URL and an empty form action'],
1101+
['http://base.com/path', '/registration', 'http://base.com/registration', 'http://domain.com/path/form', '<base> tag does work with a URL and form action'],
1102+
];
11031103
}
11041104

11051105
public function testCountOfNestedElements()
@@ -1115,7 +1115,7 @@ public function testEvaluateReturnsTypedResultOfXPathExpressionOnADocumentSubset
11151115

11161116
$result = $crawler->filterXPath('//form/input')->evaluate('substring-before(@name, "Name")');
11171117

1118-
$this->assertSame(array('Text', 'Foo', 'Bar'), $result);
1118+
$this->assertSame(['Text', 'Foo', 'Bar'], $result);
11191119
}
11201120

11211121
public function testEvaluateReturnsTypedResultOfNamespacedXPathExpressionOnADocumentSubset()
@@ -1124,7 +1124,7 @@ public function testEvaluateReturnsTypedResultOfNamespacedXPathExpressionOnADocu
11241124

11251125
$result = $crawler->filterXPath('//yt:accessControl/@action')->evaluate('string(.)');
11261126

1127-
$this->assertSame(array('comment', 'videoRespond'), $result);
1127+
$this->assertSame(['comment', 'videoRespond'], $result);
11281128
}
11291129

11301130
public function testEvaluateReturnsTypedResultOfNamespacedXPathExpression()
@@ -1134,7 +1134,7 @@ public function testEvaluateReturnsTypedResultOfNamespacedXPathExpression()
11341134

11351135
$result = $crawler->evaluate('string(//youtube:accessControl/@action)');
11361136

1137-
$this->assertSame(array('comment'), $result);
1137+
$this->assertSame(['comment'], $result);
11381138
}
11391139

11401140
public function testEvaluateReturnsACrawlerIfXPathExpressionEvaluatesToANode()

0 commit comments

Comments
 (0)