Skip to content

Commit 9be03d8

Browse files
Merge branch '4.0'
* 4.0: [CssSelector] For AND operator, the left operand should have parentheses, not only right operand Removed unused parameter from flattenDataProvider(). Update MongoDB extension on travis to make the builds green again.
2 parents 1e90ddd + e1e523b commit 9be03d8

File tree

5 files changed

+18
-16
lines changed

5 files changed

+18
-16
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ before_install:
9696
echo apc.enable_cli = 1 >> $INI
9797
echo extension = redis.so >> $INI
9898
echo extension = memcached.so >> $INI
99-
echo extension = mongodb.so >> $INI
10099
101100
# Matrix lines for intermediate PHP versions are skipped for pull requests
102101
if [[ ! $deps && ! $PHP = $MIN_PHP && $TRAVIS_PULL_REQUEST != false ]]; then
@@ -115,8 +114,9 @@ before_install:
115114
116115
- |
117116
# Install extra PHP extensions
118-
if [[ ! $skip && $PHP = 7.* ]]; then
117+
if [[ ! $skip ]]; then
119118
tfold ext.apcu5 'echo yes | pecl install -f apcu-5.1.6'
119+
tfold ext.mongodb pecl install -f mongodb-1.4.0RC1
120120
fi
121121
122122
- |

src/Symfony/Component/CssSelector/Tests/CssSelectorConverterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function getCssToXPathWithoutPrefixTestData()
5959
array('h1', 'h1'),
6060
array('foo|h1', 'foo:h1'),
6161
array('h1, h2, h3', 'h1 | h2 | h3'),
62-
array('h1:nth-child(3n+1)', "*/*[name() = 'h1' and (position() - 1 >= 0 and (position() - 1) mod 3 = 0)]"),
62+
array('h1:nth-child(3n+1)', "*/*[(name() = 'h1') and (position() - 1 >= 0 and (position() - 1) mod 3 = 0)]"),
6363
array('h1 > p', 'h1/p'),
6464
array('h1#foo', "h1[@id = 'foo']"),
6565
array('h1.foo', "h1[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"),

src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,20 @@ public function getCssToXPathTestData()
102102
array('e[foo^="bar"]', "e[@foo and starts-with(@foo, 'bar')]"),
103103
array('e[foo$="bar"]', "e[@foo and substring(@foo, string-length(@foo)-2) = 'bar']"),
104104
array('e[foo*="bar"]', "e[@foo and contains(@foo, 'bar')]"),
105+
array('e[foo!="bar"]', "e[not(@foo) or @foo != 'bar']"),
106+
array('e[foo!="bar"][foo!="baz"]', "e[(not(@foo) or @foo != 'bar') and (not(@foo) or @foo != 'baz')]"),
105107
array('e[hreflang|="en"]', "e[@hreflang and (@hreflang = 'en' or starts-with(@hreflang, 'en-'))]"),
106-
array('e:nth-child(1)', "*/*[name() = 'e' and (position() = 1)]"),
107-
array('e:nth-last-child(1)', "*/*[name() = 'e' and (position() = last() - 0)]"),
108-
array('e:nth-last-child(2n+2)', "*/*[name() = 'e' and (last() - position() - 1 >= 0 and (last() - position() - 1) mod 2 = 0)]"),
108+
array('e:nth-child(1)', "*/*[(name() = 'e') and (position() = 1)]"),
109+
array('e:nth-last-child(1)', "*/*[(name() = 'e') and (position() = last() - 0)]"),
110+
array('e:nth-last-child(2n+2)', "*/*[(name() = 'e') and (last() - position() - 1 >= 0 and (last() - position() - 1) mod 2 = 0)]"),
109111
array('e:nth-of-type(1)', '*/e[position() = 1]'),
110112
array('e:nth-last-of-type(1)', '*/e[position() = last() - 0]'),
111113
array('div e:nth-last-of-type(1) .aclass', "div/descendant-or-self::*/e[position() = last() - 0]/descendant-or-self::*/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' aclass ')]"),
112-
array('e:first-child', "*/*[name() = 'e' and (position() = 1)]"),
113-
array('e:last-child', "*/*[name() = 'e' and (position() = last())]"),
114+
array('e:first-child', "*/*[(name() = 'e') and (position() = 1)]"),
115+
array('e:last-child', "*/*[(name() = 'e') and (position() = last())]"),
114116
array('e:first-of-type', '*/e[position() = 1]'),
115117
array('e:last-of-type', '*/e[position() = last()]'),
116-
array('e:only-child', "*/*[name() = 'e' and (last() = 1)]"),
118+
array('e:only-child', "*/*[(name() = 'e') and (last() = 1)]"),
117119
array('e:only-of-type', 'e[last() = 1]'),
118120
array('e:empty', 'e[not(*) and not(string-length())]'),
119121
array('e:EmPTY', 'e[not(*) and not(string-length())]'),
@@ -127,7 +129,7 @@ public function getCssToXPathTestData()
127129
array('e:nOT(*)', 'e[0]'),
128130
array('e f', 'e/descendant-or-self::*/f'),
129131
array('e > f', 'e/f'),
130-
array('e + f', "e/following-sibling::*[name() = 'f' and (position() = 1)]"),
132+
array('e + f', "e/following-sibling::*[(name() = 'f') and (position() = 1)]"),
131133
array('e ~ f', 'e/following-sibling::f'),
132134
array('div#container p', "div[@id = 'container']/descendant-or-self::*/p"),
133135
);

src/Symfony/Component/CssSelector/XPath/XPathExpr.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function getElement(): string
4545

4646
public function addCondition(string $condition): XPathExpr
4747
{
48-
$this->condition = $this->condition ? sprintf('%s and (%s)', $this->condition, $condition) : $condition;
48+
$this->condition = $this->condition ? sprintf('(%s) and (%s)', $this->condition, $condition) : $condition;
4949

5050
return $this;
5151
}
@@ -77,7 +77,7 @@ public function addStarPrefix(): XPathExpr
7777
*
7878
* @return $this
7979
*/
80-
public function join(string $combiner, XPathExpr $expr): XPathExpr
80+
public function join(string $combiner, self $expr): self
8181
{
8282
$path = $this->__toString().$combiner;
8383

src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function testHeadersForHttpException()
111111
/**
112112
* @dataProvider flattenDataProvider
113113
*/
114-
public function testFlattenHttpException(\Exception $exception, $statusCode)
114+
public function testFlattenHttpException(\Exception $exception)
115115
{
116116
$flattened = FlattenException::create($exception);
117117
$flattened2 = FlattenException::create($exception);
@@ -126,7 +126,7 @@ public function testFlattenHttpException(\Exception $exception, $statusCode)
126126
/**
127127
* @dataProvider flattenDataProvider
128128
*/
129-
public function testPrevious(\Exception $exception, $statusCode)
129+
public function testPrevious(\Exception $exception)
130130
{
131131
$flattened = FlattenException::create($exception);
132132
$flattened2 = FlattenException::create($exception);
@@ -170,7 +170,7 @@ public function testFile(\Exception $exception)
170170
/**
171171
* @dataProvider flattenDataProvider
172172
*/
173-
public function testToArray(\Exception $exception, $statusCode)
173+
public function testToArray(\Exception $exception)
174174
{
175175
$flattened = FlattenException::create($exception);
176176
$flattened->setTrace(array(), 'foo.php', 123);
@@ -190,7 +190,7 @@ public function testToArray(\Exception $exception, $statusCode)
190190
public function flattenDataProvider()
191191
{
192192
return array(
193-
array(new \Exception('test', 123), 500),
193+
array(new \Exception('test', 123)),
194194
);
195195
}
196196

0 commit comments

Comments
 (0)