diff --git a/core/modules/rest/tests/src/Unit/RestSerializerTest.php b/core/modules/rest/tests/src/Unit/RestViewsStyleSerializerTest.php similarity index 77% rename from core/modules/rest/tests/src/Unit/RestSerializerTest.php rename to core/modules/rest/tests/src/Unit/RestViewsStyleSerializerTest.php index 8d0b1d0..2acc68e 100644 --- a/core/modules/rest/tests/src/Unit/RestSerializerTest.php +++ b/core/modules/rest/tests/src/Unit/RestViewsStyleSerializerTest.php @@ -2,19 +2,22 @@ /** * @file - * Contains \Drupal\Tests\rest\Unit\RestSerializerTest. + * Contains \Drupal\Tests\rest\Unit\RestViewsStyleSerializerTest. */ namespace Drupal\Tests\rest\Unit; +use Drupal\rest\Plugin\views\display\RestExport; use Drupal\rest\Plugin\views\style\Serializer; use Drupal\Tests\UnitTestCase; +use Drupal\views\Entity\View; +use Symfony\Component\Serializer\SerializerInterface; /** * @coversDefaultClass \Drupal\rest\Plugin\views\style\Serializer * @group rest */ -class RestSerializerTest extends UnitTestCase { +class RestViewsStyleSerializerTest extends UnitTestCase { /** * The View instance. @@ -37,7 +40,7 @@ protected function setUp() { parent::setUp(); - $this->view = $this->getMock('\Drupal\views\Entity\View', array('initHandlers'), array( + $this->view = $this->getMock(View::class, array('initHandlers'), array( array('id' => 'test_view'), 'view', )); @@ -45,13 +48,13 @@ protected function setUp() { // call. $this->view->result = []; - $this->displayHandler = $this->getMockBuilder('\Drupal\rest\Plugin\views\display\RestExport') + $this->displayHandler = $this->getMockBuilder(RestExport::class) ->disableOriginalConstructor() ->getMock(); $this->displayHandler->expects($this->any()) ->method('getContentType') - ->will($this->returnValue('json')); + ->willReturn('json'); } /** @@ -62,7 +65,7 @@ protected function setUp() { public function testSerializerReceivesOptions() { $options = ['formats' => ['xml', 'json']]; - $mock_serializer = $this->getMockBuilder('Symfony\Component\Serializer\SerializerInterface') + $mock_serializer = $this->getMockBuilder(SerializerInterface::class) ->disableOriginalConstructor() ->getMock(); @@ -71,7 +74,7 @@ public function testSerializerReceivesOptions() { $mock_serializer->expects($this->once()) ->method('serialize') ->with([], 'json', ['views_style_options' => $options]) - ->will($this->returnValue('')); + ->willReturn(''); $view_serializer = new Serializer([], 'dummy_serializer', [], $mock_serializer, ['json', 'xml']); $view_serializer->options = $options;