minor #11187 [Tests] don't disable constructor calls to mockups of classes that extend intern... (xabbuh)
This PR was merged into the 2.3 branch.
Discussion
----------
[Tests] don't disable constructor calls to mockups of classes that extend intern...
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Fixes the tests for the 2.3 branch as reported by @stof in #11176.
Commits
-------
2c726b8
don't disable constructor calls to mockups of classes that extend internal PHP classes
This commit is contained in:
commit
eeeae94196
@ -76,8 +76,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()
|
||||
;
|
||||
|
@ -59,7 +59,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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ class BinaryFileResponseTest extends ResponseTestCase
|
||||
$request->headers->set('X-Accel-Mapping', $mapping);
|
||||
|
||||
$file = $this->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
||||
->disableOriginalConstructor()
|
||||
->setConstructorArgs(array(__DIR__.'/File/Fixtures/test'))
|
||||
->getMock();
|
||||
$file->expects($this->any())
|
||||
->method('getRealPath')
|
||||
|
@ -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')
|
||||
@ -168,4 +159,19 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertTrue($this->storage->gc(-1));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$file = $this
|
||||
->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
||||
->disableOriginalConstructor()
|
||||
->setConstructorArgs(array(__DIR__.'/Fixtures/foo'))
|
||||
->getMock()
|
||||
;
|
||||
$file
|
||||
@ -193,7 +193,7 @@ abstract class FileValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$file = $this
|
||||
->getMockBuilder('Symfony\Component\HttpFoundation\File\File')
|
||||
->disableOriginalConstructor()
|
||||
->setConstructorArgs(array(__DIR__.'/Fixtures/foo'))
|
||||
->getMock()
|
||||
;
|
||||
$file
|
||||
@ -221,7 +221,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
|
||||
|
Reference in New Issue
Block a user