Skip to content

Commit 71d059c

Browse files
committed
fixed obsolete getMock() usage
1 parent f1675c2 commit 71d059c

File tree

272 files changed

+1192
-1286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

272 files changed

+1192
-1286
lines changed

src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private function createCollector($queries)
139139
->method('getDatabasePlatform')
140140
->will($this->returnValue(new MySqlPlatform()));
141141

142-
$registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry');
142+
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock();
143143
$registry
144144
->expects($this->any())
145145
->method('getConnectionNames')
@@ -152,7 +152,7 @@ private function createCollector($queries)
152152
->method('getConnection')
153153
->will($this->returnValue($connection));
154154

155-
$logger = $this->getMock('Doctrine\DBAL\Logging\DebugStack');
155+
$logger = $this->getMockBuilder('Doctrine\DBAL\Logging\DebugStack')->getMock();
156156
$logger->queries = $queries;
157157

158158
$collector = new DoctrineDataCollector($registry);

src/Symfony/Bridge/Doctrine/Tests/DataFixtures/ContainerAwareLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ContainerAwareLoaderTest extends \PHPUnit_Framework_TestCase
1818
{
1919
public function testShouldSetContainerOnContainerAwareFixture()
2020
{
21-
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
21+
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
2222
$loader = new ContainerAwareLoader($container);
2323
$fixture = new ContainerAwareFixture();
2424

src/Symfony/Bridge/Doctrine/Tests/ExpressionLanguage/DoctrineParserCacheTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class DoctrineParserCacheTest extends \PHPUnit_Framework_TestCase
1717
{
1818
public function testFetch()
1919
{
20-
$doctrineCacheMock = $this->getMock('Doctrine\Common\Cache\Cache');
20+
$doctrineCacheMock = $this->getMockBuilder('Doctrine\Common\Cache\Cache')->getMock();
2121
$parserCache = new DoctrineParserCache($doctrineCacheMock);
2222

2323
$doctrineCacheMock->expects($this->once())
@@ -31,7 +31,7 @@ public function testFetch()
3131

3232
public function testFetchUnexisting()
3333
{
34-
$doctrineCacheMock = $this->getMock('Doctrine\Common\Cache\Cache');
34+
$doctrineCacheMock = $this->getMockBuilder('Doctrine\Common\Cache\Cache')->getMock();
3535
$parserCache = new DoctrineParserCache($doctrineCacheMock);
3636

3737
$doctrineCacheMock
@@ -44,7 +44,7 @@ public function testFetchUnexisting()
4444

4545
public function testSave()
4646
{
47-
$doctrineCacheMock = $this->getMock('Doctrine\Common\Cache\Cache');
47+
$doctrineCacheMock = $this->getMockBuilder('Doctrine\Common\Cache\Cache')->getMock();
4848
$parserCache = new DoctrineParserCache($doctrineCacheMock);
4949

5050
$expression = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParsedExpression')

src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ class DoctrineChoiceLoaderTest extends \PHPUnit_Framework_TestCase
7272

7373
protected function setUp()
7474
{
75-
$this->factory = $this->getMock('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface');
76-
$this->om = $this->getMock('Doctrine\Common\Persistence\ObjectManager');
77-
$this->repository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository');
75+
$this->factory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
76+
$this->om = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')->getMock();
77+
$this->repository = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectRepository')->getMock();
7878
$this->class = 'stdClass';
7979
$this->idReader = $this->getMockBuilder('Symfony\Bridge\Doctrine\Form\ChoiceList\IdReader')
8080
->disableOriginalConstructor()
8181
->getMock();
82-
$this->objectLoader = $this->getMock('Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface');
82+
$this->objectLoader = $this->getMockBuilder('Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface')->getMock();
8383
$this->obj1 = (object) array('name' => 'A');
8484
$this->obj2 = (object) array('name' => 'B');
8585
$this->obj3 = (object) array('name' => 'C');

src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ public function requiredProvider()
8686

8787
private function getGuesser(ClassMetadata $classMetadata)
8888
{
89-
$em = $this->getMock('Doctrine\Common\Persistence\ObjectManager');
89+
$em = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')->getMock();
9090
$em->expects($this->once())->method('getClassMetaData')->with('TestEntity')->will($this->returnValue($classMetadata));
9191

92-
$registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry');
92+
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock();
9393
$registry->expects($this->once())->method('getManagers')->will($this->returnValue(array($em)));
9494

9595
return new DoctrineOrmTypeGuesser($registry);

src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class EntityTypePerformanceTest extends FormPerformanceTestCase
3232

3333
protected function getExtensions()
3434
{
35-
$manager = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry');
35+
$manager = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock();
3636

3737
$manager->expects($this->any())
3838
->method('getManager')

src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ public function testPropertyOption()
13001300

13011301
protected function createRegistryMock($name, $em)
13021302
{
1303-
$registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry');
1303+
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock();
13041304
$registry->expects($this->any())
13051305
->method('getManager')
13061306
->with($this->equalTo($name))

src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class DbalLoggerTest extends \PHPUnit_Framework_TestCase
2020
*/
2121
public function testLog($sql, $params, $logParams)
2222
{
23-
$logger = $this->getMock('Psr\\Log\\LoggerInterface');
23+
$logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
2424

2525
$dbalLogger = $this
2626
->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')
@@ -52,7 +52,7 @@ public function getLogFixtures()
5252

5353
public function testLogNonUtf8()
5454
{
55-
$logger = $this->getMock('Psr\\Log\\LoggerInterface');
55+
$logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
5656

5757
$dbalLogger = $this
5858
->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')
@@ -75,7 +75,7 @@ public function testLogNonUtf8()
7575

7676
public function testLogNonUtf8Array()
7777
{
78-
$logger = $this->getMock('Psr\\Log\\LoggerInterface');
78+
$logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
7979

8080
$dbalLogger = $this
8181
->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')
@@ -106,7 +106,7 @@ public function testLogNonUtf8Array()
106106

107107
public function testLogLongString()
108108
{
109-
$logger = $this->getMock('Psr\\Log\\LoggerInterface');
109+
$logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
110110

111111
$dbalLogger = $this
112112
->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')
@@ -137,7 +137,7 @@ public function testLogLongString()
137137
*/
138138
public function testLogUTF8LongString()
139139
{
140-
$logger = $this->getMock('Psr\\Log\\LoggerInterface');
140+
$logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
141141

142142
$dbalLogger = $this
143143
->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')

src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function testSupportProxy()
150150

151151
private function getManager($em, $name = null)
152152
{
153-
$manager = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry');
153+
$manager = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock();
154154
$manager->expects($this->any())
155155
->method('getManager')
156156
->with($this->equalTo($name))

src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected function setUp()
6363

6464
protected function createRegistryMock(ObjectManager $em = null)
6565
{
66-
$registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry');
66+
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock();
6767
$registry->expects($this->any())
6868
->method('getManager')
6969
->with($this->equalTo(self::EM_NAME))
@@ -92,7 +92,7 @@ protected function createEntityManagerMock($repositoryMock)
9292
->will($this->returnValue($repositoryMock))
9393
;
9494

95-
$classMetadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');
95+
$classMetadata = $this->getMockBuilder('Doctrine\Common\Persistence\Mapping\ClassMetadata')->getMock();
9696
$classMetadata
9797
->expects($this->any())
9898
->method('hasField')

0 commit comments

Comments
 (0)