You are here

protected function RewriteTest::getMockItem in Tamper 8

Get a mock item to use in the test.

Return value

\Drupal\tamper\TamperableItemInterface|\PHPUnit_Framework_MockObject_MockObject The mock of a tamperable item to use in the test.

1 call to RewriteTest::getMockItem()
RewriteTest::testRewrite in tests/src/Unit/Plugin/Tamper/RewriteTest.php
Tests the rewrite functionality.

File

tests/src/Unit/Plugin/Tamper/RewriteTest.php, line 32

Class

RewriteTest
Tests the rewrite plugin.

Namespace

Drupal\Tests\tamper\Unit\Plugin\Tamper

Code

protected function getMockItem() {
  $item = $this
    ->createMock(TamperableItemInterface::class);
  $item
    ->expects($this
    ->any())
    ->method('getSource')
    ->willReturn([
    'title' => 'Yay title!',
    'body' => 'Yay body!',
    'foo' => 'bar',
  ]);
  return $item;
}