You are here

class SlickAdminUnitTest in Slick Carousel 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/Form/SlickAdminUnitTest.php \Drupal\Tests\slick\Unit\Form\SlickAdminUnitTest

Tests the Slick admin form.

@coversDefaultClass \Drupal\slick\Form\SlickAdmin @group slick

Hierarchy

Expanded class hierarchy of SlickAdminUnitTest

File

tests/src/Unit/Form/SlickAdminUnitTest.php, line 15

Namespace

Drupal\Tests\slick\Unit\Form
View source
class SlickAdminUnitTest extends UnitTestCase {

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();
    $this->blazyAdminExtended = $this
      ->getMockBuilder('\\Drupal\\blazy\\Dejavu\\BlazyAdminExtended')
      ->disableOriginalConstructor()
      ->getMock();
    $this->slickManager = $this
      ->getMock('\\Drupal\\slick\\SlickManagerInterface');
  }

  /**
   * @covers ::create
   * @covers ::__construct
   * @covers ::blazyAdmin
   * @covers ::manager
   */
  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());
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PhpunitCompatibilityTrait::getMock Deprecated public function Returns a mock object for the specified class using the available method.
PhpunitCompatibilityTrait::setExpectedException Deprecated public function Compatibility layer for PHPUnit 6 to support PHPUnit 4 code.
SlickAdminUnitTest::setUp protected function Overrides UnitTestCase::setUp
SlickAdminUnitTest::testBlazyAdminCreate public function @covers ::create @covers ::__construct @covers ::blazyAdmin @covers ::manager
UnitTestCase::$randomGenerator protected property The random generator.
UnitTestCase::$root protected property The app root. 1
UnitTestCase::assertArrayEquals protected function Asserts if two arrays are equal by sorting them first.
UnitTestCase::getBlockMockWithMachineName Deprecated protected function Mocks a block with a block plugin. 1
UnitTestCase::getClassResolverStub protected function Returns a stub class resolver.
UnitTestCase::getConfigFactoryStub public function Returns a stub config factory that behaves according to the passed array.
UnitTestCase::getConfigStorageStub public function Returns a stub config storage that returns the supplied configuration.
UnitTestCase::getContainerWithCacheTagsInvalidator protected function Sets up a container with a cache tags invalidator.
UnitTestCase::getRandomGenerator protected function Gets the random generator for the utility methods.
UnitTestCase::getStringTranslationStub public function Returns a stub translation manager that just returns the passed string.
UnitTestCase::randomMachineName public function Generates a unique random string containing letters and numbers.