GridStackFormUnitTest.php in GridStack 8.2
File
tests/src/Unit/Form/GridStackFormUnitTest.php
View source
<?php
namespace Drupal\Tests\gridstack\Unit\Form;
use Drupal\Tests\UnitTestCase;
use Drupal\gridstack_ui\Form\GridStackForm;
use Symfony\Component\DependencyInjection\ContainerInterface;
class GridStackFormUnitTest extends UnitTestCase {
protected $messenger;
protected function setUp() {
parent::setUp();
$this->fileSystem = $this
->getMockBuilder('\\Drupal\\Core\\File\\FileSystem')
->disableOriginalConstructor()
->getMock();
$this->blazyAdmin = $this
->getMockBuilder('\\Drupal\\blazy\\Form\\BlazyAdminInterface')
->disableOriginalConstructor()
->getMock();
$this->gridstackManager = $this
->createMock('\\Drupal\\gridstack\\GridStackManagerInterface');
}
public function testGridStackFormCreate() {
$container = $this
->createMock(ContainerInterface::class);
$exception = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
$map = [
[
'file_system',
$exception,
$this->fileSystem,
],
[
'blazy.admin',
$exception,
$this->blazyAdmin,
],
[
'gridstack.manager',
$exception,
$this->gridstackManager,
],
];
$container
->expects($this
->any())
->method('get')
->willReturnMap($map);
$gridstackForm = GridStackForm::create($container);
$this
->assertInstanceOf(GridStackForm::class, $gridstackForm);
}
}