Skip to content

Commit 23901df

Browse files
committed
minor #54785 Remove calls to TestCase::iniSet() and calls to deprecated methods of MockBuilder (alexandre-daubois)
This PR was merged into the 5.4 branch. Discussion ---------- Remove calls to `TestCase::iniSet()` and calls to deprecated methods of `MockBuilder` | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT Last round (before new deprecations 🙂). All deprecations [listed here](https://github.com/sebastianbergmann/phpunit/blob/main/DEPRECATIONS.md) should be gone. Commits ------- 4d5065ddd9 Remove calls to `TestCase::iniSet()` and calls to deprecated methods of `MockBuilder`
2 parents 9e61309 + 8fbb744 commit 23901df

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\Doctrine\Tests\Fixtures;
13+
14+
use Doctrine\ORM\EntityRepository;
15+
16+
class MockableRepository extends EntityRepository
17+
{
18+
public function findByCustom()
19+
{
20+
}
21+
}

Tests/Validator/Constraints/UniqueEntityValidatorTest.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleNameEntity;
2929
use Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleNullableNameEntity;
3030
use Symfony\Bridge\Doctrine\Tests\Fixtures\Employee;
31+
use Symfony\Bridge\Doctrine\Tests\Fixtures\MockableRepository;
3132
use Symfony\Bridge\Doctrine\Tests\Fixtures\Person;
3233
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity;
3334
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity;
@@ -97,14 +98,10 @@ protected function createRegistryMock($em = null)
9798

9899
protected function createRepositoryMock()
99100
{
100-
$repository = $this->getMockBuilder(EntityRepository::class)
101+
return $this->getMockBuilder(MockableRepository::class)
101102
->disableOriginalConstructor()
102-
->onlyMethods(['find', 'findAll', 'findOneBy', 'findBy', 'getClassName'])
103-
->addMethods(['findByCustom'])
104-
->getMock()
105-
;
106-
107-
return $repository;
103+
->onlyMethods(['find', 'findAll', 'findOneBy', 'findBy', 'getClassName', 'findByCustom'])
104+
->getMock();
108105
}
109106

110107
protected function createEntityManagerMock($repositoryMock)

0 commit comments

Comments
 (0)