SlickAdminUnitTest.php in Slick Carousel 8
File
tests/src/Unit/Form/SlickAdminUnitTest.php
View source
<?php
namespace Drupal\Tests\slick\Unit\Form;
use Drupal\Tests\UnitTestCase;
use Drupal\slick\Form\SlickAdmin;
use Symfony\Component\DependencyInjection\ContainerInterface;
class SlickAdminUnitTest extends UnitTestCase {
protected function setUp() {
parent::setUp();
$this->blazyAdminExtended = $this
->getMockBuilder('\\Drupal\\blazy\\Dejavu\\BlazyAdminExtended')
->disableOriginalConstructor()
->getMock();
$this->slickManager = $this
->getMock('\\Drupal\\slick\\SlickManagerInterface');
}
public function testBlazyAdminCreate() {
$container = $this
->getMock(ContainerInterface::class);
$exception = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
$map = [
[
'blazy.admin.extended',
$exception,
$this->blazyAdminExtended,
],
[
'slick.manager',
$exception,
$this->slickManager,
],
];
$container
->expects($this
->any())
->method('get')
->willReturnMap($map);
$slickAdmin = SlickAdmin::create($container);
$this
->assertInstanceOf(SlickAdmin::class, $slickAdmin);
$this
->assertInstanceOf('\\Drupal\\blazy\\Dejavu\\BlazyAdminExtended', $slickAdmin
->blazyAdmin());
$this
->assertInstanceOf('\\Drupal\\slick\\SlickManagerInterface', $slickAdmin
->manager());
}
}