public function PaymentMethodConfigurationListBuilderTest::testRender in Payment 8.2
@covers ::render
@depends testBuildHeader
File
- tests/
src/ Unit/ Entity/ PaymentMethodConfiguration/ PaymentMethodConfigurationListBuilderTest.php, line 168
Class
- PaymentMethodConfigurationListBuilderTest
- @coversDefaultClass \Drupal\payment\Entity\PaymentMethodConfiguration\PaymentMethodConfigurationListBuilder
Namespace
Drupal\Tests\payment\Unit\Entity\PaymentMethodConfigurationCode
public function testRender() {
$query = $this
->createMock(QueryInterface::class);
$query
->expects($this
->atLeastOnce())
->method('pager')
->willReturnSelf();
$query
->expects($this
->atLeastOnce())
->method('sort')
->willReturnSelf();
$this->entityStorage
->expects($this
->atLeastOnce())
->method('getQuery')
->willReturn($query);
$this->entityType
->expects($this
->any())
->method('getClass')
->willReturn(ConfigEntityBase::class);
$this->entityStorage
->expects($this
->once())
->method('loadMultipleOverrideFree')
->willReturn([]);
$build = $this->sut
->render();
unset($build['table']['#attached']);
unset($build['table']['#header']);
$expected_build = array(
'#type' => 'table',
'#title' => NULL,
'#rows' => [],
'#attributes' => array(
'class' => array(
'payment-method-configuration-list',
),
),
'#cache' => [
'contexts' => NULL,
'tags' => NULL,
],
);
$this
->assertInstanceOf(TranslatableMarkup::class, $build['table']['#empty']);
unset($build['table']['#empty']);
$this
->assertEquals($expected_build, $build['table']);
}