diff --git a/tests/Controller/CRUDControllerTest.php b/tests/Controller/CRUDControllerTest.php index 279d6e3befc..92d27f7fe52 100644 --- a/tests/Controller/CRUDControllerTest.php +++ b/tests/Controller/CRUDControllerTest.php @@ -40,6 +40,7 @@ use Sonata\Exporter\Exporter; use Sonata\Exporter\Source\SourceIteratorInterface; use Sonata\Exporter\Writer\JsonWriter; +use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine; use Symfony\Component\DependencyInjection\Container; @@ -74,6 +75,10 @@ */ class CRUDControllerTest extends TestCase { + use ExpectDeprecationTrait { + expectDeprecation as traitExpectDeprecation; + } + /** * @var CRUDController */ @@ -1665,10 +1670,11 @@ public function testEditActionAjaxError(): void /** * @legacy - * @expectedDeprecation In next major version response will return 406 NOT ACCEPTABLE without `Accept: application/json` */ public function testEditActionAjaxErrorWithoutAcceptApplicationJson(): void { + $this->traitExpectDeprecation('In next major version response will return 406 NOT ACCEPTABLE without `Accept: application/json` or `Accept: */*`'); + $object = new \stdClass(); $this->admin->expects($this->once()) @@ -2363,10 +2369,11 @@ public function testCreateActionAjaxError(): void /** * @legacy - * @expectedDeprecation In next major version response will return 406 NOT ACCEPTABLE without `Accept: application/json` */ public function testCreateActionAjaxErrorWithoutAcceptApplicationJson(): void { + $this->traitExpectDeprecation('In next major version response will return 406 NOT ACCEPTABLE without `Accept: application/json` or `Accept: */*`'); + $this->admin->expects($this->once()) ->method('checkAccess') ->with($this->equalTo('create'))