You are here

function CurrencyListBuilderTest::testBuildRow in Currency 8.3

@covers ::buildRow

File

tests/src/Unit/Entity/Currency/CurrencyListBuilderTest.php, line 110

Class

CurrencyListBuilderTest
@coversDefaultClass \Drupal\currency\Entity\Currency\CurrencyListBuilder

Namespace

Drupal\Tests\currency\Unit\Entity\Currency

Code

function testBuildRow() {
  $entity_id = $this
    ->randomMachineName();
  $entity_label = $this
    ->randomMachineName();
  $currency = $this
    ->createMock(CurrencyInterface::class);
  $currency
    ->expects($this
    ->any())
    ->method('id')
    ->willReturn($entity_id);
  $currency
    ->expects($this
    ->any())
    ->method('label')
    ->willReturn($entity_label);
  $this->moduleHandler
    ->expects($this
    ->any())
    ->method('invokeAll')
    ->willReturn([]);
  $row = $this->sut
    ->buildRow($currency);
  $expected = array(
    'id' => $entity_id,
    'label' => $entity_label,
    'operations' => array(
      'data' => array(
        '#type' => 'operations',
        '#links' => array(),
      ),
    ),
  );
  $this
    ->assertSame($expected, $row);
}