From cc3e3d54ea82d9acf0f2be19b3be3e11ed6e59fb Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 6 Sep 2019 09:54:22 +0200 Subject: [PATCH] Fix more bad tests --- .../Monolog/Tests/ClassThatInheritLogger.php | 27 ++++++ .../Bridge/Monolog/Tests/LoggerTest.php | 25 +---- .../ClassThatInheritDebugProcessor.php | 27 ++++++ .../Tests/Processor/DebugProcessorTest.php | 25 +---- .../Controller/AbstractControllerTest.php | 12 +-- .../Tests/Controller/ControllerTraitTest.php | 27 ------ .../Tests/Controller/TestController.php | 24 ++++- .../BrowserKit/Tests/AbstractBrowserTest.php | 66 -------------- .../Tests/ClassThatInheritClient.php | 44 +++++++++ .../BrowserKit/Tests/HttpBrowserTest.php | 91 ------------------- .../Component/BrowserKit/Tests/TestClient.php | 57 ++++++++++++ .../BrowserKit/Tests/TestHttpClient.php | 80 ++++++++++++++++ .../DomCrawler/Tests/AbstractCrawlerTest.php | 8 -- .../Tests/ClassThatInheritCrawler.php | 25 +++++ .../Finder/Tests/ClassThatInheritFinder.php | 25 +++++ .../Component/Finder/Tests/FinderTest.php | 9 +- .../Form/Tests/AbstractTypeExtensionTest.php | 19 +--- .../Form/Tests/MultipleTypesExtension.php | 25 +++++ .../TypeExtensionWithoutExtendedTypes.php | 18 ++++ 19 files changed, 365 insertions(+), 269 deletions(-) create mode 100644 src/Symfony/Bridge/Monolog/Tests/ClassThatInheritLogger.php create mode 100644 src/Symfony/Bridge/Monolog/Tests/Processor/ClassThatInheritDebugProcessor.php create mode 100644 src/Symfony/Component/BrowserKit/Tests/ClassThatInheritClient.php create mode 100644 src/Symfony/Component/BrowserKit/Tests/TestClient.php create mode 100644 src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php create mode 100644 src/Symfony/Component/DomCrawler/Tests/ClassThatInheritCrawler.php create mode 100644 src/Symfony/Component/Finder/Tests/ClassThatInheritFinder.php create mode 100644 src/Symfony/Component/Form/Tests/MultipleTypesExtension.php create mode 100644 src/Symfony/Component/Form/Tests/TypeExtensionWithoutExtendedTypes.php diff --git a/src/Symfony/Bridge/Monolog/Tests/ClassThatInheritLogger.php b/src/Symfony/Bridge/Monolog/Tests/ClassThatInheritLogger.php new file mode 100644 index 0000000000..31c62e3e75 --- /dev/null +++ b/src/Symfony/Bridge/Monolog/Tests/ClassThatInheritLogger.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Monolog\Tests; + +use Symfony\Bridge\Monolog\Logger; + +class ClassThatInheritLogger extends Logger +{ + public function getLogs(): array + { + return parent::getLogs(); + } + + public function countErrors(): int + { + return parent::countErrors(); + } +} diff --git a/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php b/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php index 143200f6c5..2b2c7a3763 100644 --- a/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php @@ -128,33 +128,12 @@ class LoggerTest extends TestCase /** * @group legacy * @expectedDeprecation The "Symfony\Bridge\Monolog\Logger::getLogs()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2. + * @expectedDeprecation The "Symfony\Bridge\Monolog\Logger::countErrors()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2. */ - public function testInheritedClassCallGetLogsWithoutArgument() + public function testInheritedClassWithoutArgument() { $loggerChild = new ClassThatInheritLogger('test'); $loggerChild->getLogs(); - } - - /** - * @group legacy - * @expectedDeprecation The "Symfony\Bridge\Monolog\Logger::countErrors()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2. - */ - public function testInheritedClassCallCountErrorsWithoutArgument() - { - $loggerChild = new ClassThatInheritLogger('test'); $loggerChild->countErrors(); } } - -class ClassThatInheritLogger extends Logger -{ - public function getLogs() - { - parent::getLogs(); - } - - public function countErrors() - { - parent::countErrors(); - } -} diff --git a/src/Symfony/Bridge/Monolog/Tests/Processor/ClassThatInheritDebugProcessor.php b/src/Symfony/Bridge/Monolog/Tests/Processor/ClassThatInheritDebugProcessor.php new file mode 100644 index 0000000000..1f15bd9f76 --- /dev/null +++ b/src/Symfony/Bridge/Monolog/Tests/Processor/ClassThatInheritDebugProcessor.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Monolog\Tests\Processor; + +use Symfony\Bridge\Monolog\Processor\DebugProcessor; + +class ClassThatInheritDebugProcessor extends DebugProcessor +{ + public function getLogs(): array + { + return parent::getLogs(); + } + + public function countErrors(): int + { + return parent::countErrors(); + } +} diff --git a/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php b/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php index 9aceb9337e..37456b801d 100644 --- a/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php @@ -66,20 +66,12 @@ class DebugProcessorTest extends TestCase /** * @group legacy * @expectedDeprecation The "Symfony\Bridge\Monolog\Processor\DebugProcessor::getLogs()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2. + * @expectedDeprecation The "Symfony\Bridge\Monolog\Processor\DebugProcessor::countErrors()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2. */ - public function testInheritedClassCallGetLogsWithoutArgument() + public function testInheritedClassWithoutArgument() { $debugProcessorChild = new ClassThatInheritDebugProcessor(); $debugProcessorChild->getLogs(); - } - - /** - * @group legacy - * @expectedDeprecation The "Symfony\Bridge\Monolog\Processor\DebugProcessor::countErrors()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2. - */ - public function testInheritedClassCallCountErrorsWithoutArgument() - { - $debugProcessorChild = new ClassThatInheritDebugProcessor(); $debugProcessorChild->countErrors(); } @@ -96,16 +88,3 @@ class DebugProcessorTest extends TestCase ]; } } - -class ClassThatInheritDebugProcessor extends DebugProcessor -{ - public function getLogs() - { - parent::getLogs(); - } - - public function countErrors() - { - parent::countErrors(); - } -} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php index cca30c3f3f..68db3bb99f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php @@ -81,8 +81,6 @@ class AbstractControllerTest extends ControllerTraitTest class TestAbstractController extends AbstractController { - use TestControllerTrait; - private $throwOnUnexpectedService; public function __construct($throwOnUnexpectedService = true) @@ -90,6 +88,11 @@ class TestAbstractController extends AbstractController $this->throwOnUnexpectedService = $throwOnUnexpectedService; } + public function __call(string $method, array $arguments) + { + return $this->$method(...$arguments); + } + public function setContainer(ContainerInterface $container) { if (!$this->throwOnUnexpectedService) { @@ -114,11 +117,6 @@ class TestAbstractController extends AbstractController return parent::setContainer($container); } - public function getParameter(string $name) - { - return parent::getParameter($name); - } - public function fooAction() { } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php index 2f9e901be9..b65c6421a7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php @@ -12,7 +12,6 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Controller; use Fig\Link\Link; -use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait; use Symfony\Bundle\FrameworkBundle\Tests\TestCase; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\Form\Form; @@ -550,29 +549,3 @@ abstract class ControllerTraitTest extends TestCase $this->assertContains($link2, $links); } } - -trait TestControllerTrait -{ - use ControllerTrait { - generateUrl as public; - redirect as public; - forward as public; - getUser as public; - json as public; - file as public; - isGranted as public; - denyAccessUnlessGranted as public; - redirectToRoute as public; - addFlash as public; - isCsrfTokenValid as public; - renderView as public; - render as public; - stream as public; - createNotFoundException as public; - createAccessDeniedException as public; - createForm as public; - createFormBuilder as public; - getDoctrine as public; - addLink as public; - } -} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TestController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TestController.php index 595dfd8d32..58a49797ca 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TestController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TestController.php @@ -3,8 +3,30 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait; class TestController extends Controller { - use TestControllerTrait; + use ControllerTrait { + generateUrl as public; + redirect as public; + forward as public; + getUser as public; + json as public; + file as public; + isGranted as public; + denyAccessUnlessGranted as public; + redirectToRoute as public; + addFlash as public; + isCsrfTokenValid as public; + renderView as public; + render as public; + stream as public; + createNotFoundException as public; + createAccessDeniedException as public; + createForm as public; + createFormBuilder as public; + getDoctrine as public; + addLink as public; + } } diff --git a/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php b/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php index 0d492e9234..39875600c1 100644 --- a/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php @@ -19,61 +19,6 @@ use Symfony\Component\BrowserKit\History; use Symfony\Component\BrowserKit\Response; use Symfony\Component\DomCrawler\Form as DomCrawlerForm; -class SpecialResponse extends Response -{ -} - -class TestClient extends AbstractBrowser -{ - protected $nextResponse = null; - protected $nextScript = null; - - public function setNextResponse(Response $response) - { - $this->nextResponse = $response; - } - - public function setNextScript($script) - { - $this->nextScript = $script; - } - - protected function doRequest($request) - { - if (null === $this->nextResponse) { - return new Response(); - } - - $response = $this->nextResponse; - $this->nextResponse = null; - - return $response; - } - - protected function filterResponse($response) - { - if ($response instanceof SpecialResponse) { - return new Response($response->getContent(), $response->getStatusCode(), $response->getHeaders()); - } - - return $response; - } - - protected function getScript($request) - { - $r = new \ReflectionClass('Symfony\Component\BrowserKit\Response'); - $path = $r->getFileName(); - - return <<nextScript); -EOF; - } -} - class AbstractBrowserTest extends TestCase { public function getBrowser(array $server = [], History $history = null, CookieJar $cookieJar = null) @@ -159,17 +104,6 @@ class AbstractBrowserTest extends TestCase $this->assertNull($client->getResponse()); } - public function testGetInternalResponse() - { - $client = $this->getBrowser(); - $client->setNextResponse(new SpecialResponse('foo')); - $client->request('GET', 'http://example.com/'); - - $this->assertInstanceOf('Symfony\Component\BrowserKit\Response', $client->getInternalResponse()); - $this->assertNotInstanceOf('Symfony\Component\BrowserKit\Tests\SpecialResponse', $client->getInternalResponse()); - $this->assertInstanceOf('Symfony\Component\BrowserKit\Tests\SpecialResponse', $client->getResponse()); - } - /** * @group legacy * @expectedDeprecation Calling the "Symfony\Component\BrowserKit\Tests\%s::getInternalResponse()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0. diff --git a/src/Symfony/Component/BrowserKit/Tests/ClassThatInheritClient.php b/src/Symfony/Component/BrowserKit/Tests/ClassThatInheritClient.php new file mode 100644 index 0000000000..9f6a55ae9d --- /dev/null +++ b/src/Symfony/Component/BrowserKit/Tests/ClassThatInheritClient.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\BrowserKit\Tests; + +use Symfony\Component\BrowserKit\AbstractBrowser; +use Symfony\Component\BrowserKit\Response; +use Symfony\Component\DomCrawler\Crawler; +use Symfony\Component\DomCrawler\Form as DomCrawlerForm; + +class ClassThatInheritClient extends AbstractBrowser +{ + protected $nextResponse = null; + + public function setNextResponse(Response $response) + { + $this->nextResponse = $response; + } + + protected function doRequest($request): Response + { + if (null === $this->nextResponse) { + return new Response(); + } + + $response = $this->nextResponse; + $this->nextResponse = null; + + return $response; + } + + public function submit(DomCrawlerForm $form, array $values = []): Crawler + { + return parent::submit($form, $values); + } +} diff --git a/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php b/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php index ae9f143cad..44eed997bd 100644 --- a/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php @@ -14,89 +14,9 @@ namespace Symfony\Component\BrowserKit\Tests; use Symfony\Component\BrowserKit\CookieJar; use Symfony\Component\BrowserKit\History; use Symfony\Component\BrowserKit\HttpBrowser; -use Symfony\Component\BrowserKit\Response; -use Symfony\Component\HttpClient\MockHttpClient; -use Symfony\Component\HttpClient\Response\MockResponse; use Symfony\Contracts\HttpClient\HttpClientInterface; use Symfony\Contracts\HttpClient\ResponseInterface; -class SpecialHttpResponse extends Response -{ -} - -class TestHttpClient extends HttpBrowser -{ - protected $nextResponse = null; - protected $nextScript = null; - - public function __construct(array $server = [], History $history = null, CookieJar $cookieJar = null) - { - $client = new MockHttpClient(function (string $method, string $url, array $options) { - if (null === $this->nextResponse) { - return new MockResponse(); - } - - return new MockResponse($this->nextResponse->getContent(), [ - 'http_code' => $this->nextResponse->getStatusCode(), - 'response_headers' => $this->nextResponse->getHeaders(), - ]); - }); - parent::__construct($client); - - $this->setServerParameters($server); - $this->history = $history ?? new History(); - $this->cookieJar = $cookieJar ?? new CookieJar(); - } - - public function setNextResponse(Response $response) - { - $this->nextResponse = $response; - } - - public function setNextScript($script) - { - $this->nextScript = $script; - } - - protected function filterResponse($response) - { - if ($response instanceof SpecialHttpResponse) { - return new Response($response->getContent(), $response->getStatusCode(), $response->getHeaders()); - } - - return $response; - } - - protected function doRequest($request) - { - $response = parent::doRequest($request); - - if (null === $this->nextResponse) { - return $response; - } - - $class = \get_class($this->nextResponse); - $response = new $class($response->getContent(), $response->getStatusCode(), $response->getHeaders()); - $this->nextResponse = null; - - return $response; - } - - protected function getScript($request) - { - $r = new \ReflectionClass('Symfony\Component\BrowserKit\Response'); - $path = $r->getFileName(); - - return <<nextScript); -EOF; - } -} - class HttpBrowserTest extends AbstractBrowserTest { public function getBrowser(array $server = [], History $history = null, CookieJar $cookieJar = null) @@ -104,17 +24,6 @@ class HttpBrowserTest extends AbstractBrowserTest return new TestHttpClient($server, $history, $cookieJar); } - public function testGetInternalResponse() - { - $client = $this->getBrowser(); - $client->setNextResponse(new SpecialHttpResponse('foo')); - $client->request('GET', 'http://example.com/'); - - $this->assertInstanceOf('Symfony\Component\BrowserKit\Response', $client->getInternalResponse()); - $this->assertNotInstanceOf('Symfony\Component\BrowserKit\Tests\SpecialHttpResponse', $client->getInternalResponse()); - $this->assertInstanceOf('Symfony\Component\BrowserKit\Tests\SpecialHttpResponse', $client->getResponse()); - } - /** * @dataProvider validContentTypes */ diff --git a/src/Symfony/Component/BrowserKit/Tests/TestClient.php b/src/Symfony/Component/BrowserKit/Tests/TestClient.php new file mode 100644 index 0000000000..0efa48b98b --- /dev/null +++ b/src/Symfony/Component/BrowserKit/Tests/TestClient.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\BrowserKit\Tests; + +use Symfony\Component\BrowserKit\AbstractBrowser; +use Symfony\Component\BrowserKit\Response; + +class TestClient extends AbstractBrowser +{ + protected $nextResponse = null; + protected $nextScript = null; + + public function setNextResponse(Response $response) + { + $this->nextResponse = $response; + } + + public function setNextScript($script) + { + $this->nextScript = $script; + } + + protected function doRequest($request): Response + { + if (null === $this->nextResponse) { + return new Response(); + } + + $response = $this->nextResponse; + $this->nextResponse = null; + + return $response; + } + + protected function getScript($request) + { + $r = new \ReflectionClass('Symfony\Component\BrowserKit\Response'); + $path = $r->getFileName(); + + return <<nextScript); +EOF; + } +} diff --git a/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php b/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php new file mode 100644 index 0000000000..cbdc2ae1d2 --- /dev/null +++ b/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\BrowserKit\Tests; + +use Symfony\Component\BrowserKit\CookieJar; +use Symfony\Component\BrowserKit\History; +use Symfony\Component\BrowserKit\HttpBrowser; +use Symfony\Component\BrowserKit\Response; +use Symfony\Component\HttpClient\MockHttpClient; +use Symfony\Component\HttpClient\Response\MockResponse; + +class TestHttpClient extends HttpBrowser +{ + protected $nextResponse = null; + protected $nextScript = null; + + public function __construct(array $server = [], History $history = null, CookieJar $cookieJar = null) + { + $client = new MockHttpClient(function (string $method, string $url, array $options) { + if (null === $this->nextResponse) { + return new MockResponse(); + } + + return new MockResponse($this->nextResponse->getContent(), [ + 'http_code' => $this->nextResponse->getStatusCode(), + 'response_headers' => $this->nextResponse->getHeaders(), + ]); + }); + parent::__construct($client); + + $this->setServerParameters($server); + $this->history = $history ?? new History(); + $this->cookieJar = $cookieJar ?? new CookieJar(); + } + + public function setNextResponse(Response $response) + { + $this->nextResponse = $response; + } + + public function setNextScript($script) + { + $this->nextScript = $script; + } + + protected function doRequest($request): Response + { + if (null === $this->nextResponse) { + return parent::doRequest($request); + } + + $response = $this->nextResponse; + $this->nextResponse = null; + + return $response; + } + + protected function getScript($request) + { + $r = new \ReflectionClass('Symfony\Component\BrowserKit\Response'); + $path = $r->getFileName(); + + return <<nextScript); +EOF; + } +} diff --git a/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php index 7a8196b9f1..bffffb7547 100644 --- a/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php @@ -1238,11 +1238,3 @@ HTML; return $domxpath->query('//div'); } } - -class ClassThatInheritCrawler extends Crawler -{ - public function children() - { - parent::children(); - } -} diff --git a/src/Symfony/Component/DomCrawler/Tests/ClassThatInheritCrawler.php b/src/Symfony/Component/DomCrawler/Tests/ClassThatInheritCrawler.php new file mode 100644 index 0000000000..2b2ac1092e --- /dev/null +++ b/src/Symfony/Component/DomCrawler/Tests/ClassThatInheritCrawler.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DomCrawler\Tests; + +use Symfony\Component\DomCrawler\Crawler; + +class ClassThatInheritCrawler extends Crawler +{ + /** + * @return static + */ + public function children() + { + return parent::children(); + } +} diff --git a/src/Symfony/Component/Finder/Tests/ClassThatInheritFinder.php b/src/Symfony/Component/Finder/Tests/ClassThatInheritFinder.php new file mode 100644 index 0000000000..f937f6247c --- /dev/null +++ b/src/Symfony/Component/Finder/Tests/ClassThatInheritFinder.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests; + +use Symfony\Component\Finder\Finder; + +class ClassThatInheritFinder extends Finder +{ + /** + * @return $this + */ + public function sortByName() + { + parent::sortByName(); + } +} diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php index 19b1909e87..16a5b2a2f2 100644 --- a/src/Symfony/Component/Finder/Tests/FinderTest.php +++ b/src/Symfony/Component/Finder/Tests/FinderTest.php @@ -873,6 +873,7 @@ class FinderTest extends Iterator\RealIteratorTestCase $expected = [ self::$tmpDir.\DIRECTORY_SEPARATOR.'test.php', + __DIR__.\DIRECTORY_SEPARATOR.'ClassThatInheritFinder.php', __DIR__.\DIRECTORY_SEPARATOR.'GitignoreTest.php', __DIR__.\DIRECTORY_SEPARATOR.'FinderTest.php', __DIR__.\DIRECTORY_SEPARATOR.'GlobTest.php', @@ -1435,11 +1436,3 @@ class FinderTest extends Iterator\RealIteratorTestCase return Finder::create(); } } - -class ClassThatInheritFinder extends Finder -{ - public function sortByName() - { - parent::sortByName(); - } -} diff --git a/src/Symfony/Component/Form/Tests/AbstractTypeExtensionTest.php b/src/Symfony/Component/Form/Tests/AbstractTypeExtensionTest.php index 48e6a9145f..b50812ffa1 100644 --- a/src/Symfony/Component/Form/Tests/AbstractTypeExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractTypeExtensionTest.php @@ -12,12 +12,13 @@ namespace Symfony\Component\Form\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\Form\AbstractTypeExtension; use Symfony\Component\Form\Extension\Core\Type\DateTimeType; -use Symfony\Component\Form\Extension\Core\Type\DateType; class AbstractTypeExtensionTest extends TestCase { + /** + * @group legacy + */ public function testImplementingNeitherGetExtendedTypeNorExtendsTypeThrowsException() { $this->expectException('Symfony\Component\Form\Exception\LogicException'); @@ -28,6 +29,7 @@ class AbstractTypeExtensionTest extends TestCase /** * @group legacy + * @expectedDeprecation The Symfony\Component\Form\Tests\MultipleTypesExtension::getExtendedType() method is deprecated since Symfony 4.2 and will be removed in 5.0. Use getExtendedTypes() instead. */ public function testGetExtendedTypeReturnsFirstConfiguredExtension() { @@ -36,16 +38,3 @@ class AbstractTypeExtensionTest extends TestCase $this->assertSame(DateTimeType::class, $extension->getExtendedType()); } } - -class MultipleTypesExtension extends AbstractTypeExtension -{ - public static function getExtendedTypes(): iterable - { - yield DateTimeType::class; - yield DateType::class; - } -} - -class TypeExtensionWithoutExtendedTypes extends AbstractTypeExtension -{ -} diff --git a/src/Symfony/Component/Form/Tests/MultipleTypesExtension.php b/src/Symfony/Component/Form/Tests/MultipleTypesExtension.php new file mode 100644 index 0000000000..3eca855f5e --- /dev/null +++ b/src/Symfony/Component/Form/Tests/MultipleTypesExtension.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests; + +use Symfony\Component\Form\AbstractTypeExtension; +use Symfony\Component\Form\Extension\Core\Type\DateTimeType; +use Symfony\Component\Form\Extension\Core\Type\DateType; + +class MultipleTypesExtension extends AbstractTypeExtension +{ + public static function getExtendedTypes(): iterable + { + yield DateTimeType::class; + yield DateType::class; + } +} diff --git a/src/Symfony/Component/Form/Tests/TypeExtensionWithoutExtendedTypes.php b/src/Symfony/Component/Form/Tests/TypeExtensionWithoutExtendedTypes.php new file mode 100644 index 0000000000..edad8fc732 --- /dev/null +++ b/src/Symfony/Component/Form/Tests/TypeExtensionWithoutExtendedTypes.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests; + +use Symfony\Component\Form\AbstractTypeExtension; + +class TypeExtensionWithoutExtendedTypes extends AbstractTypeExtension +{ +}