merged 2.0
This commit is contained in:
commit
595e6d6ca2
@ -20,8 +20,8 @@
|
||||
"doctrine/common": "2.2.*"
|
||||
},
|
||||
"recommend": {
|
||||
"doctrine/dbal": ">=2.1",
|
||||
"doctrine/orm": ">=2.1"
|
||||
"doctrine/dbal": ">=2.1,<2.3",
|
||||
"doctrine/orm": ">=2.1,<2.3"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/form": "self.version",
|
||||
|
@ -484,6 +484,6 @@ abstract class Client
|
||||
*/
|
||||
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::')
|
||||
{
|
||||
if (is_string($cssExpr)) {
|
||||
if (!$cssExpr) {
|
||||
return $prefix.'*';
|
||||
}
|
||||
|
||||
if (preg_match('#^\w+\s*$#u', $cssExpr, $match)) {
|
||||
return $prefix.trim($match[0]);
|
||||
}
|
||||
|
@ -18,10 +18,10 @@
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"symfony/event-dispatcher": "self.version",
|
||||
"symfony/locale": "self.version",
|
||||
"symfony/validator": "self.version"
|
||||
"symfony/locale": "self.version"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/validator": "self.version",
|
||||
"symfony/http-foundation": "self.version"
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -51,8 +51,9 @@ class Locale extends \Locale
|
||||
|
||||
$collator = new \Collator($locale);
|
||||
$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
|
||||
// Countries have alphabetic codes
|
||||
// "ZZ" is the code for unknown country
|
||||
@ -105,8 +106,9 @@ class Locale extends \Locale
|
||||
|
||||
$collator = new \Collator($locale);
|
||||
$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
|
||||
if ('mul' !== $code) {
|
||||
$languages[$code] = $name;
|
||||
@ -155,8 +157,9 @@ class Locale extends \Locale
|
||||
|
||||
$collator = new \Collator($locale);
|
||||
$locales = array();
|
||||
$bundleLocales = $bundle->get('Locales') ?: array();
|
||||
|
||||
foreach ($bundle->get('Locales') as $code => $name) {
|
||||
foreach ($bundleLocales as $code => $name) {
|
||||
$locales[$code] = $name;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"doctrine/common": ">=2.1"
|
||||
"doctrine/common": ">=2.1,<2.3"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/http-foundation": "self.version",
|
||||
|
@ -270,28 +270,61 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
public function testBack()
|
||||
{
|
||||
$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->back();
|
||||
|
||||
$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()
|
||||
{
|
||||
$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');
|
||||
$client->request('GET', 'http://www.example.com/foo', $parameters, $files, $server, $content);
|
||||
$client->back();
|
||||
$client->forward();
|
||||
|
||||
$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()
|
||||
{
|
||||
$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();
|
||||
$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()
|
||||
|
@ -17,6 +17,7 @@ class CssSelectorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
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[@id = '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