diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueValidatorTest.php index 57eaf3295a..c96418de4a 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueValidatorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueValidatorTest.php @@ -63,8 +63,12 @@ class UniqueValidatorTest extends \PHPUnit_Framework_TestCase ->method('hasField') ->will($this->returnValue(true)) ; - $refl = $this->getMockBuilder('Doctrine\Common\Reflection\StaticReflectionProperty') + $reflParser = $this->getMockBuilder('Doctrine\Common\Reflection\StaticReflectionParser') ->disableOriginalConstructor() + ->getMock() + ; + $refl = $this->getMockBuilder('Doctrine\Common\Reflection\StaticReflectionProperty') + ->setConstructorArgs(array($reflParser, 'property-name')) ->setMethods(array('getValue')) ->getMock() ; diff --git a/src/Symfony/Bundle/TwigBundle/composer.json b/src/Symfony/Bundle/TwigBundle/composer.json index 49e32a193e..3dd1a7218f 100644 --- a/src/Symfony/Bundle/TwigBundle/composer.json +++ b/src/Symfony/Bundle/TwigBundle/composer.json @@ -25,7 +25,8 @@ "symfony/dependency-injection": "~2.0", "symfony/config": "~2.2", "symfony/routing": "~2.1", - "symfony/templating": "~2.1" + "symfony/templating": "~2.1", + "symfony/framework-bundle": "~2.1" }, "autoload": { "psr-0": { "Symfony\\Bundle\\TwigBundle\\": "" } diff --git a/src/Symfony/Component/Console/Helper/DialogHelper.php b/src/Symfony/Component/Console/Helper/DialogHelper.php index 26e9474a9c..1ce4192df6 100644 --- a/src/Symfony/Component/Console/Helper/DialogHelper.php +++ b/src/Symfony/Component/Console/Helper/DialogHelper.php @@ -157,7 +157,7 @@ class DialogHelper extends InputAwareHelper $c .= fread($inputStream, 2); // A = Up Arrow. B = Down Arrow - if ('A' === $c[2] || 'B' === $c[2]) { + if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) { if ('A' === $c[2] && -1 === $ofs) { $ofs = 0; } diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php index b4b2230189..106c13fb50 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php @@ -96,6 +96,8 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase if ($datas = posix_getgrgid($infos['gid'])) { return $datas['name']; } + + $this->markTestSkipped('Unable to retrieve file group name'); } protected function markAsSkippedIfSymlinkIsMissing() diff --git a/src/Symfony/Component/Finder/Adapter/AbstractFindAdapter.php b/src/Symfony/Component/Finder/Adapter/AbstractFindAdapter.php index 01940385de..5c7206240e 100644 --- a/src/Symfony/Component/Finder/Adapter/AbstractFindAdapter.php +++ b/src/Symfony/Component/Finder/Adapter/AbstractFindAdapter.php @@ -256,6 +256,7 @@ abstract class AbstractFindAdapter extends AbstractAdapter case '!=': $command->add('-size -'.$size->getTarget().'c'); $command->add('-size +'.$size->getTarget().'c'); + break; case '<': default: $command->add('-size -'.$size->getTarget().'c'); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php index 0227af4f23..96ec0c30a8 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php @@ -78,7 +78,7 @@ class FileTypeTest extends \Symfony\Component\Form\Test\TypeTestCase { $file = $this ->getMockBuilder('Symfony\Component\HttpFoundation\File\UploadedFile') - ->disableOriginalConstructor() + ->setConstructorArgs(array(__DIR__.'/../../../Fixtures/foo', 'foo')) ->getMock() ; $file diff --git a/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php index 2d5cf7764b..b25380aea7 100644 --- a/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php @@ -48,7 +48,7 @@ class HttpFoundationRequestHandlerTest extends AbstractRequestHandlerTest protected function getMockFile() { return $this->getMockBuilder('Symfony\Component\HttpFoundation\File\UploadedFile') - ->disableOriginalConstructor() + ->setConstructorArgs(array(__DIR__.'/../../Fixtures/foo', 'foo')) ->getMock(); } } diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index e79ad63c82..f59edf5327 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -358,6 +358,7 @@ class Request if (!isset($server['CONTENT_TYPE'])) { $server['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'; } + // no break case 'PATCH': $request = $parameters; $query = array(); @@ -955,7 +956,13 @@ class Request } if ($host = $this->headers->get('HOST')) { - if (false !== $pos = strrpos($host, ':')) { + if ($host[0] === '[') { + $pos = strpos($host, ':', strrpos($host, ']')); + } else { + $pos = strrpos($host, ':'); + } + + if (false !== $pos) { return intval(substr($host, $pos + 1)); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php index 69b099885a..d7d1b03c3c 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php @@ -180,16 +180,16 @@ class BinaryFileResponseTest extends ResponseTestCase $request->headers->set('X-Accel-Mapping', $mapping); $file = $this->getMockBuilder('Symfony\Component\HttpFoundation\File\File') - ->disableOriginalConstructor() - ->getMock(); + ->setConstructorArgs(array(__DIR__.'/File/Fixtures/test')) + ->getMock(); $file->expects($this->any()) ->method('getRealPath') ->will($this->returnValue($realpath)); $file->expects($this->any()) ->method('isReadable') ->will($this->returnValue(true)); - $file->expects($this->any()) - ->method('getMTime') + $file->expects($this->any()) + ->method('getMTime') ->will($this->returnValue(time())); BinaryFileResponse::trustXSendFileTypeHeader(); diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 556c9dde8a..ea9e0ceb84 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -163,6 +163,14 @@ class RequestTest extends \PHPUnit_Framework_TestCase $this->assertEquals(90, $request->getPort()); $this->assertTrue($request->isSecure()); + $request = Request::create('https://[::1]/foo'); + $this->assertEquals('https://[::1]/foo', $request->getUri()); + $this->assertEquals('/foo', $request->getPathInfo()); + $this->assertEquals('[::1]', $request->getHost()); + $this->assertEquals('[::1]', $request->getHttpHost()); + $this->assertEquals(443, $request->getPort()); + $this->assertTrue($request->isSecure()); + $json = '{"jsonrpc":"2.0","method":"echo","id":7,"params":["Hello World"]}'; $request = Request::create('http://example.com/jsonrpc', 'POST', array(), array(), array(), array(), $json); $this->assertEquals($json, $request->getContent()); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index d907ce4a90..2feb6a83c0 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -34,7 +34,6 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase $mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient'; $this->mongo = $this->getMockBuilder($mongoClass) - ->disableOriginalConstructor() ->getMock(); $this->options = array( @@ -76,9 +75,7 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase public function testWrite() { - $collection = $this->getMockBuilder('MongoCollection') - ->disableOriginalConstructor() - ->getMock(); + $collection = $this->createMongoCollectionMock(); $this->mongo->expects($this->once()) ->method('selectCollection') @@ -105,9 +102,7 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase public function testReplaceSessionData() { - $collection = $this->getMockBuilder('MongoCollection') - ->disableOriginalConstructor() - ->getMock(); + $collection = $this->createMongoCollectionMock(); $this->mongo->expects($this->once()) ->method('selectCollection') @@ -130,9 +125,7 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase public function testDestroy() { - $collection = $this->getMockBuilder('MongoCollection') - ->disableOriginalConstructor() - ->getMock(); + $collection = $this->createMongoCollectionMock(); $this->mongo->expects($this->once()) ->method('selectCollection') @@ -148,9 +141,7 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase public function testGc() { - $collection = $this->getMockBuilder('MongoCollection') - ->disableOriginalConstructor() - ->getMock(); + $collection = $this->createMongoCollectionMock(); $this->mongo->expects($this->once()) ->method('selectCollection') @@ -178,4 +169,19 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf($mongoClass, $method->invoke($this->storage)); } + + private function createMongoCollectionMock() + { + + $mongoClient = $this->getMockBuilder('MongoClient') + ->getMock(); + $mongoDb = $this->getMockBuilder('MongoDB') + ->setConstructorArgs(array($mongoClient, 'database-name')) + ->getMock(); + $collection = $this->getMockBuilder('MongoCollection') + ->setConstructorArgs(array($mongoDb, 'collection-name')) + ->getMock(); + + return $collection; + } } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php index d2d2bcb34f..8b9ce99b80 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php @@ -199,7 +199,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase { $file = $this ->getMockBuilder('Symfony\Component\HttpFoundation\File\File') - ->disableOriginalConstructor() + ->setConstructorArgs(array(__DIR__.'/Fixtures/foo')) ->getMock() ; $file @@ -227,7 +227,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase { $file = $this ->getMockBuilder('Symfony\Component\HttpFoundation\File\File') - ->disableOriginalConstructor() + ->setConstructorArgs(array(__DIR__.'/Fixtures/foo')) ->getMock() ; $file @@ -255,7 +255,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase { $file = $this ->getMockBuilder('Symfony\Component\HttpFoundation\File\File') - ->disableOriginalConstructor() + ->setConstructorArgs(array(__DIR__.'/Fixtures/foo')) ->getMock() ; $file @@ -289,7 +289,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase { $file = $this ->getMockBuilder('Symfony\Component\HttpFoundation\File\File') - ->disableOriginalConstructor() + ->setConstructorArgs(array(__DIR__.'/Fixtures/foo')) ->getMock() ; $file diff --git a/src/Symfony/Component/Validator/Tests/Constraints/Fixtures/foo b/src/Symfony/Component/Validator/Tests/Constraints/Fixtures/foo new file mode 100644 index 0000000000..e69de29bb2