GridStackFormUnitTest.php in GridStack 8
File
tests/src/Unit/Form/GridStackFormUnitTest.php
View source
<?php
namespace Drupal\Tests\gridstack\Unit\Form;
use Drupal\Tests\UnitTestCase;
use Drupal\Core\Messenger\Messenger;
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->messenger = $this
->getMockBuilder('\\Drupal\\Core\\Messenger\\Messenger')
->disableOriginalConstructor()
->getMock();
$this->blazyAdmin = $this
->getMockBuilder('\\Drupal\\blazy\\Form\\BlazyAdminInterface')
->disableOriginalConstructor()
->getMock();
$this->gridstackManager = $this
->getMock('\\Drupal\\gridstack\\GridStackManagerInterface');
}
public function testBlazyAdminCreate() {
$container = $this
->getMock(ContainerInterface::class);
$exception = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
$map = [
[
'file_system',
$exception,
$this->fileSystem,
],
[
'messenger',
$exception,
$this->messenger,
],
[
'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);
}
}