Merge branch '2.3' into 2.4
* 2.3: Added missing `break` statement don't disable constructor calls to mockups of classes that extend internal PHP classes Small comment update according to PSR-2 [Console] Fixed notice in DialogHelper [HttpFoundation] Fixed Request::getPort returns incorrect value under IPv6 [Filesystem] Fix test suite on OSX Add framework-bundle Conflicts: src/Symfony/Component/Filesystem/Tests/FilesystemTest.php src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
This commit is contained in:
commit
b387477d51
@ -63,8 +63,12 @@ class UniqueValidatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
->method('hasField')
|
->method('hasField')
|
||||||
->will($this->returnValue(true))
|
->will($this->returnValue(true))
|
||||||
;
|
;
|
||||||
$refl = $this->getMockBuilder('Doctrine\Common\Reflection\StaticReflectionProperty')
|
$reflParser = $this->getMockBuilder('Doctrine\Common\Reflection\StaticReflectionParser')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
|
->getMock()
|
||||||
|
;
|
||||||
|
$refl = $this->getMockBuilder('Doctrine\Common\Reflection\StaticReflectionProperty')
|
||||||
|
->setConstructorArgs(array($reflParser, 'property-name'))
|
||||||
->setMethods(array('getValue'))
|
->setMethods(array('getValue'))
|
||||||
->getMock()
|
->getMock()
|
||||||
;
|
;
|
||||||
|
@ -23,7 +23,8 @@
|
|||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/stopwatch": "~2.2",
|
"symfony/stopwatch": "~2.2",
|
||||||
"symfony/dependency-injection": "~2.0",
|
"symfony/dependency-injection": "~2.0",
|
||||||
"symfony/config": "~2.2"
|
"symfony/config": "~2.2",
|
||||||
|
"symfony/framework-bundle": "~2.1"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": { "Symfony\\Bundle\\TwigBundle\\": "" }
|
"psr-0": { "Symfony\\Bundle\\TwigBundle\\": "" }
|
||||||
|
@ -154,7 +154,7 @@ class DialogHelper extends InputAwareHelper
|
|||||||
$c .= fread($inputStream, 2);
|
$c .= fread($inputStream, 2);
|
||||||
|
|
||||||
// A = Up Arrow. B = Down Arrow
|
// 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) {
|
if ('A' === $c[2] && -1 === $ofs) {
|
||||||
$ofs = 0;
|
$ofs = 0;
|
||||||
}
|
}
|
||||||
|
@ -256,6 +256,7 @@ abstract class AbstractFindAdapter extends AbstractAdapter
|
|||||||
case '!=':
|
case '!=':
|
||||||
$command->add('-size -'.$size->getTarget().'c');
|
$command->add('-size -'.$size->getTarget().'c');
|
||||||
$command->add('-size +'.$size->getTarget().'c');
|
$command->add('-size +'.$size->getTarget().'c');
|
||||||
|
break;
|
||||||
case '<':
|
case '<':
|
||||||
default:
|
default:
|
||||||
$command->add('-size -'.$size->getTarget().'c');
|
$command->add('-size -'.$size->getTarget().'c');
|
||||||
|
@ -59,7 +59,7 @@ class FileTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||||||
{
|
{
|
||||||
$file = $this
|
$file = $this
|
||||||
->getMockBuilder('Symfony\Component\HttpFoundation\File\UploadedFile')
|
->getMockBuilder('Symfony\Component\HttpFoundation\File\UploadedFile')
|
||||||
->disableOriginalConstructor()
|
->setConstructorArgs(array(__DIR__.'/../../../Fixtures/foo', 'foo'))
|
||||||
->getMock()
|
->getMock()
|
||||||
;
|
;
|
||||||
$file
|
$file
|
||||||
|
@ -48,7 +48,7 @@ class HttpFoundationRequestHandlerTest extends AbstractRequestHandlerTest
|
|||||||
protected function getMockFile()
|
protected function getMockFile()
|
||||||
{
|
{
|
||||||
return $this->getMockBuilder('Symfony\Component\HttpFoundation\File\UploadedFile')
|
return $this->getMockBuilder('Symfony\Component\HttpFoundation\File\UploadedFile')
|
||||||
->disableOriginalConstructor()
|
->setConstructorArgs(array(__DIR__.'/../../Fixtures/foo', 'foo'))
|
||||||
->getMock();
|
->getMock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -358,6 +358,7 @@ class Request
|
|||||||
if (!isset($server['CONTENT_TYPE'])) {
|
if (!isset($server['CONTENT_TYPE'])) {
|
||||||
$server['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
|
$server['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
|
||||||
}
|
}
|
||||||
|
// no break
|
||||||
case 'PATCH':
|
case 'PATCH':
|
||||||
$request = $parameters;
|
$request = $parameters;
|
||||||
$query = array();
|
$query = array();
|
||||||
@ -955,7 +956,13 @@ class Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($host = $this->headers->get('HOST')) {
|
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));
|
return intval(substr($host, $pos + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,16 +180,16 @@ class BinaryFileResponseTest extends ResponseTestCase
|
|||||||
$request->headers->set('X-Accel-Mapping', $mapping);
|
$request->headers->set('X-Accel-Mapping', $mapping);
|
||||||
|
|
||||||
$file = $this->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
$file = $this->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
||||||
->disableOriginalConstructor()
|
->setConstructorArgs(array(__DIR__.'/File/Fixtures/test'))
|
||||||
->getMock();
|
->getMock();
|
||||||
$file->expects($this->any())
|
$file->expects($this->any())
|
||||||
->method('getRealPath')
|
->method('getRealPath')
|
||||||
->will($this->returnValue($realpath));
|
->will($this->returnValue($realpath));
|
||||||
$file->expects($this->any())
|
$file->expects($this->any())
|
||||||
->method('isReadable')
|
->method('isReadable')
|
||||||
->will($this->returnValue(true));
|
->will($this->returnValue(true));
|
||||||
$file->expects($this->any())
|
$file->expects($this->any())
|
||||||
->method('getMTime')
|
->method('getMTime')
|
||||||
->will($this->returnValue(time()));
|
->will($this->returnValue(time()));
|
||||||
|
|
||||||
BinaryFileResponse::trustXSendFileTypeHeader();
|
BinaryFileResponse::trustXSendFileTypeHeader();
|
||||||
|
@ -163,6 +163,14 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals(90, $request->getPort());
|
$this->assertEquals(90, $request->getPort());
|
||||||
$this->assertTrue($request->isSecure());
|
$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"]}';
|
$json = '{"jsonrpc":"2.0","method":"echo","id":7,"params":["Hello World"]}';
|
||||||
$request = Request::create('http://example.com/jsonrpc', 'POST', array(), array(), array(), array(), $json);
|
$request = Request::create('http://example.com/jsonrpc', 'POST', array(), array(), array(), array(), $json);
|
||||||
$this->assertEquals($json, $request->getContent());
|
$this->assertEquals($json, $request->getContent());
|
||||||
|
@ -34,7 +34,6 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient';
|
$mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient';
|
||||||
|
|
||||||
$this->mongo = $this->getMockBuilder($mongoClass)
|
$this->mongo = $this->getMockBuilder($mongoClass)
|
||||||
->disableOriginalConstructor()
|
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$this->options = array(
|
$this->options = array(
|
||||||
@ -76,9 +75,7 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testWrite()
|
public function testWrite()
|
||||||
{
|
{
|
||||||
$collection = $this->getMockBuilder('MongoCollection')
|
$collection = $this->createMongoCollectionMock();
|
||||||
->disableOriginalConstructor()
|
|
||||||
->getMock();
|
|
||||||
|
|
||||||
$this->mongo->expects($this->once())
|
$this->mongo->expects($this->once())
|
||||||
->method('selectCollection')
|
->method('selectCollection')
|
||||||
@ -105,9 +102,7 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testReplaceSessionData()
|
public function testReplaceSessionData()
|
||||||
{
|
{
|
||||||
$collection = $this->getMockBuilder('MongoCollection')
|
$collection = $this->createMongoCollectionMock();
|
||||||
->disableOriginalConstructor()
|
|
||||||
->getMock();
|
|
||||||
|
|
||||||
$this->mongo->expects($this->once())
|
$this->mongo->expects($this->once())
|
||||||
->method('selectCollection')
|
->method('selectCollection')
|
||||||
@ -130,9 +125,7 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testDestroy()
|
public function testDestroy()
|
||||||
{
|
{
|
||||||
$collection = $this->getMockBuilder('MongoCollection')
|
$collection = $this->createMongoCollectionMock();
|
||||||
->disableOriginalConstructor()
|
|
||||||
->getMock();
|
|
||||||
|
|
||||||
$this->mongo->expects($this->once())
|
$this->mongo->expects($this->once())
|
||||||
->method('selectCollection')
|
->method('selectCollection')
|
||||||
@ -148,9 +141,7 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testGc()
|
public function testGc()
|
||||||
{
|
{
|
||||||
$collection = $this->getMockBuilder('MongoCollection')
|
$collection = $this->createMongoCollectionMock();
|
||||||
->disableOriginalConstructor()
|
|
||||||
->getMock();
|
|
||||||
|
|
||||||
$this->mongo->expects($this->once())
|
$this->mongo->expects($this->once())
|
||||||
->method('selectCollection')
|
->method('selectCollection')
|
||||||
@ -178,4 +169,19 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->assertInstanceOf($mongoClass, $method->invoke($this->storage));
|
$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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$file = $this
|
$file = $this
|
||||||
->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
||||||
->disableOriginalConstructor()
|
->setConstructorArgs(array(__DIR__.'/Fixtures/foo'))
|
||||||
->getMock()
|
->getMock()
|
||||||
;
|
;
|
||||||
$file
|
$file
|
||||||
@ -189,7 +189,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$file = $this
|
$file = $this
|
||||||
->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
||||||
->disableOriginalConstructor()
|
->setConstructorArgs(array(__DIR__.'/Fixtures/foo'))
|
||||||
->getMock()
|
->getMock()
|
||||||
;
|
;
|
||||||
$file
|
$file
|
||||||
@ -217,7 +217,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$file = $this
|
$file = $this
|
||||||
->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
||||||
->disableOriginalConstructor()
|
->setConstructorArgs(array(__DIR__.'/Fixtures/foo'))
|
||||||
->getMock()
|
->getMock()
|
||||||
;
|
;
|
||||||
$file
|
$file
|
||||||
@ -251,7 +251,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$file = $this
|
$file = $this
|
||||||
->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
||||||
->disableOriginalConstructor()
|
->setConstructorArgs(array(__DIR__.'/Fixtures/foo'))
|
||||||
->getMock()
|
->getMock()
|
||||||
;
|
;
|
||||||
$file
|
$file
|
||||||
|
Reference in New Issue
Block a user