GridStackAdminUnitTest.php in GridStack 8.2
File
tests/src/Unit/Form/GridStackAdminUnitTest.php
View source
<?php
namespace Drupal\Tests\gridstack\Unit\Form;
use Drupal\Tests\UnitTestCase;
use Drupal\gridstack\Form\GridStackAdmin;
use Symfony\Component\DependencyInjection\ContainerInterface;
class GridStackAdminUnitTest extends UnitTestCase {
protected function setUp() {
parent::setUp();
$this->blazyAdminExtended = $this
->getMockBuilder('\\Drupal\\blazy\\Dejavu\\BlazyAdminExtended')
->disableOriginalConstructor()
->getMock();
$this->gridstackManager = $this
->createMock('\\Drupal\\gridstack\\GridStackManagerInterface');
}
public function testBlazyAdminCreate() {
$container = $this
->createMock(ContainerInterface::class);
$exception = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
$map = [
[
'blazy.admin.extended',
$exception,
$this->blazyAdminExtended,
],
[
'gridstack.manager',
$exception,
$this->gridstackManager,
],
];
$container
->expects($this
->any())
->method('get')
->willReturnMap($map);
$gridstackAdmin = GridStackAdmin::create($container);
$this
->assertInstanceOf(GridStackAdmin::class, $gridstackAdmin);
$this
->assertInstanceOf('\\Drupal\\blazy\\Dejavu\\BlazyAdminExtended', $gridstackAdmin
->blazyAdmin());
$this
->assertInstanceOf('\\Drupal\\gridstack\\GridStackManagerInterface', $gridstackAdmin
->manager());
}
}