ComponentDiscoveryTest.php in Lightning Core 8.4
File
tests/src/Kernel/ComponentDiscoveryTest.php
View source
<?php
namespace Drupal\Tests\lightning_core\Kernel;
use Drupal\Core\Extension\Extension;
use Drupal\KernelTests\KernelTestBase;
use Drupal\lightning_core\ComponentDiscovery;
class ComponentDiscoveryTest extends KernelTestBase {
protected $discovery;
protected function setUp() {
parent::setUp();
$this->discovery = new ComponentDiscovery($this->container
->get('app.root'));
}
public function testGetAll() {
$components = $this->discovery
->getAll();
$this
->assertInstanceOf(Extension::class, $components['lightning_core']);
$this
->assertInstanceOf(Extension::class, $components['lightning_search']);
$this
->assertArrayNotHasKey('panels', $components);
$this
->assertArrayNotHasKey('views', $components);
}
public function testGetMainComponents() {
$components = $this->discovery
->getMainComponents();
$this
->assertInstanceOf(Extension::class, $components['lightning_core']);
$this
->assertArrayNotHasKey('lightning_contact_form', $components);
$this
->assertArrayNotHasKey('lightning_page', $components);
$this
->assertArrayNotHasKey('lightning_roles', $components);
$this
->assertArrayNotHasKey('lightning_search', $components);
}
public function testGetSubComponents() {
$components = $this->discovery
->getSubComponents();
$this
->assertInstanceOf(Extension::class, $components['lightning_contact_form']);
$this
->assertInstanceOf(Extension::class, $components['lightning_page']);
$this
->assertInstanceOf(Extension::class, $components['lightning_roles']);
$this
->assertInstanceOf(Extension::class, $components['lightning_search']);
$this
->assertArrayNotHasKey('lightning_core', $components);
}
}