merged 2.0
This commit is contained in:
commit
595e6d6ca2
@ -20,8 +20,8 @@
|
|||||||
"doctrine/common": "2.2.*"
|
"doctrine/common": "2.2.*"
|
||||||
},
|
},
|
||||||
"recommend": {
|
"recommend": {
|
||||||
"doctrine/dbal": ">=2.1",
|
"doctrine/dbal": ">=2.1,<2.3",
|
||||||
"doctrine/orm": ">=2.1"
|
"doctrine/orm": ">=2.1,<2.3"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"symfony/form": "self.version",
|
"symfony/form": "self.version",
|
||||||
|
@ -484,6 +484,6 @@ abstract class Client
|
|||||||
*/
|
*/
|
||||||
protected function requestFromRequest(Request $request, $changeHistory = true)
|
protected function requestFromRequest(Request $request, $changeHistory = true)
|
||||||
{
|
{
|
||||||
return $this->request($request->getMethod(), $request->getUri(), $request->getParameters(), array(), $request->getFiles(), $request->getServer(), $request->getContent(), $changeHistory);
|
return $this->request($request->getMethod(), $request->getUri(), $request->getParameters(), $request->getFiles(), $request->getServer(), $request->getContent(), $changeHistory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,10 @@ class CssSelector
|
|||||||
static public function toXPath($cssExpr, $prefix = 'descendant-or-self::')
|
static public function toXPath($cssExpr, $prefix = 'descendant-or-self::')
|
||||||
{
|
{
|
||||||
if (is_string($cssExpr)) {
|
if (is_string($cssExpr)) {
|
||||||
|
if (!$cssExpr) {
|
||||||
|
return $prefix.'*';
|
||||||
|
}
|
||||||
|
|
||||||
if (preg_match('#^\w+\s*$#u', $cssExpr, $match)) {
|
if (preg_match('#^\w+\s*$#u', $cssExpr, $match)) {
|
||||||
return $prefix.trim($match[0]);
|
return $prefix.trim($match[0]);
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.2",
|
"php": ">=5.3.2",
|
||||||
"symfony/event-dispatcher": "self.version",
|
"symfony/event-dispatcher": "self.version",
|
||||||
"symfony/locale": "self.version",
|
"symfony/locale": "self.version"
|
||||||
"symfony/validator": "self.version"
|
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
|
"symfony/validator": "self.version",
|
||||||
"symfony/http-foundation": "self.version"
|
"symfony/http-foundation": "self.version"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -51,8 +51,9 @@ class Locale extends \Locale
|
|||||||
|
|
||||||
$collator = new \Collator($locale);
|
$collator = new \Collator($locale);
|
||||||
$countries = array();
|
$countries = array();
|
||||||
|
$bundleCountries = $bundle->get('Countries') ?: array();
|
||||||
|
|
||||||
foreach ($bundle->get('Countries') as $code => $name) {
|
foreach ($bundleCountries as $code => $name) {
|
||||||
// Global countries (f.i. "America") have numeric codes
|
// Global countries (f.i. "America") have numeric codes
|
||||||
// Countries have alphabetic codes
|
// Countries have alphabetic codes
|
||||||
// "ZZ" is the code for unknown country
|
// "ZZ" is the code for unknown country
|
||||||
@ -105,8 +106,9 @@ class Locale extends \Locale
|
|||||||
|
|
||||||
$collator = new \Collator($locale);
|
$collator = new \Collator($locale);
|
||||||
$languages = array();
|
$languages = array();
|
||||||
|
$bundleLanguages = $bundle->get('Languages') ?: array();
|
||||||
|
|
||||||
foreach ($bundle->get('Languages') as $code => $name) {
|
foreach ($bundleLanguages as $code => $name) {
|
||||||
// "mul" is the code for multiple languages
|
// "mul" is the code for multiple languages
|
||||||
if ('mul' !== $code) {
|
if ('mul' !== $code) {
|
||||||
$languages[$code] = $name;
|
$languages[$code] = $name;
|
||||||
@ -155,8 +157,9 @@ class Locale extends \Locale
|
|||||||
|
|
||||||
$collator = new \Collator($locale);
|
$collator = new \Collator($locale);
|
||||||
$locales = array();
|
$locales = array();
|
||||||
|
$bundleLocales = $bundle->get('Locales') ?: array();
|
||||||
|
|
||||||
foreach ($bundle->get('Locales') as $code => $name) {
|
foreach ($bundleLocales as $code => $name) {
|
||||||
$locales[$code] = $name;
|
$locales[$code] = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.2",
|
"php": ">=5.3.2",
|
||||||
"doctrine/common": ">=2.1"
|
"doctrine/common": ">=2.1,<2.3"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"symfony/http-foundation": "self.version",
|
"symfony/http-foundation": "self.version",
|
||||||
|
@ -270,28 +270,61 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testBack()
|
public function testBack()
|
||||||
{
|
{
|
||||||
$client = new TestClient();
|
$client = new TestClient();
|
||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
|
||||||
|
$parameters = array('foo' => 'bar');
|
||||||
|
$files = array('myfile.foo' => 'baz');
|
||||||
|
$server = array('X_TEST_FOO' => 'bazbar');
|
||||||
|
$content = 'foobarbaz';
|
||||||
|
|
||||||
|
$client->request('GET', 'http://www.example.com/foo/foobar', $parameters, $files, $server, $content);
|
||||||
$client->request('GET', 'http://www.example.com/foo');
|
$client->request('GET', 'http://www.example.com/foo');
|
||||||
$client->back();
|
$client->back();
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/foo/foobar', $client->getRequest()->getUri(), '->back() goes back in the history');
|
$this->assertEquals('http://www.example.com/foo/foobar', $client->getRequest()->getUri(), '->back() goes back in the history');
|
||||||
|
$this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->back() keeps parameters');
|
||||||
|
$this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->back() keeps files');
|
||||||
|
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->back() keeps $_SERVER');
|
||||||
|
$this->assertEquals($content, $client->getRequest()->getContent(), '->back() keeps content');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testForward()
|
public function testForward()
|
||||||
{
|
{
|
||||||
$client = new TestClient();
|
$client = new TestClient();
|
||||||
|
|
||||||
|
$parameters = array('foo' => 'bar');
|
||||||
|
$files = array('myfile.foo' => 'baz');
|
||||||
|
$server = array('X_TEST_FOO' => 'bazbar');
|
||||||
|
$content = 'foobarbaz';
|
||||||
|
|
||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
$client->request('GET', 'http://www.example.com/foo');
|
$client->request('GET', 'http://www.example.com/foo', $parameters, $files, $server, $content);
|
||||||
$client->back();
|
$client->back();
|
||||||
$client->forward();
|
$client->forward();
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->forward() goes forward in the history');
|
$this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->forward() goes forward in the history');
|
||||||
|
$this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->forward() keeps parameters');
|
||||||
|
$this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->forward() keeps files');
|
||||||
|
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->forward() keeps $_SERVER');
|
||||||
|
$this->assertEquals($content, $client->getRequest()->getContent(), '->forward() keeps content');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testReload()
|
public function testReload()
|
||||||
{
|
{
|
||||||
$client = new TestClient();
|
$client = new TestClient();
|
||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
|
||||||
|
$parameters = array('foo' => 'bar');
|
||||||
|
$files = array('myfile.foo' => 'baz');
|
||||||
|
$server = array('X_TEST_FOO' => 'bazbar');
|
||||||
|
$content = 'foobarbaz';
|
||||||
|
|
||||||
|
$client->request('GET', 'http://www.example.com/foo/foobar', $parameters, $files, $server, $content);
|
||||||
$client->reload();
|
$client->reload();
|
||||||
$this->assertEquals('http://www.example.com/foo/foobar', $client->getRequest()->getUri(), '->forward() reloads the current page');
|
|
||||||
|
$this->assertEquals('http://www.example.com/foo/foobar', $client->getRequest()->getUri(), '->reload() reloads the current page');
|
||||||
|
$this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->reload() keeps parameters');
|
||||||
|
$this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->reload() keeps files');
|
||||||
|
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->reload() keeps $_SERVER');
|
||||||
|
$this->assertEquals($content, $client->getRequest()->getContent(), '->reload() keeps content');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRestart()
|
public function testRestart()
|
||||||
|
@ -17,6 +17,7 @@ class CssSelectorTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
public function testCsstoXPath()
|
public function testCsstoXPath()
|
||||||
{
|
{
|
||||||
|
$this->assertEquals('descendant-or-self::*', CssSelector::toXPath(''));
|
||||||
$this->assertEquals('descendant-or-self::h1', CssSelector::toXPath('h1'));
|
$this->assertEquals('descendant-or-self::h1', CssSelector::toXPath('h1'));
|
||||||
$this->assertEquals("descendant-or-self::h1[@id = 'foo']", CssSelector::toXPath('h1#foo'));
|
$this->assertEquals("descendant-or-self::h1[@id = 'foo']", CssSelector::toXPath('h1#foo'));
|
||||||
$this->assertEquals("descendant-or-self::h1[contains(concat(' ', normalize-space(@class), ' '), ' foo ')]", CssSelector::toXPath('h1.foo'));
|
$this->assertEquals("descendant-or-self::h1[contains(concat(' ', normalize-space(@class), ' '), ' foo ')]", CssSelector::toXPath('h1.foo'));
|
||||||
|
Reference in New Issue
Block a user