FlagFollowerInstallUninstallTest.php in Flag 8.4
File
modules/flag_follower/tests/src/Kernel/FlagFollowerInstallUninstallTest.php
View source
<?php
namespace Drupal\Tests\flag_follower\Kernel;
use Drupal\flag\Entity\Flag;
use Drupal\Tests\flag\Kernel\FlagKernelTestBase;
use Drupal\views\Entity\View;
class FlagFollowerInstallUninstallTest extends FlagKernelTestBase {
public static $modules = [
'field',
'text',
];
public function testInstallUninstall() {
$this
->installConfig([
'node',
]);
$this
->installSchema('system', [
'key_value_expire',
]);
$this
->installSchema('user', [
'users_data',
]);
$this->container
->get('module_installer')
->install([
'flag_follower',
]);
$this
->doTestsOnInstall();
$this->container
->get('module_installer')
->uninstall([
'flag_follower',
]);
$this
->assertNull(Flag::load('bookmark'));
$this
->assertNull(View::load('flag_bookmark'));
$this->container
->get('module_installer')
->install([
'flag_follower',
]);
$this
->doTestsOnInstall();
}
protected function doTestsOnInstall() {
$this
->assertEquals([
'user',
'flag_follower',
], Flag::load('following')
->getDependencies()['module']);
$this
->assertEquals([
'flag.flag.following',
], View::load('flag_followers')
->getDependencies()['config']);
$this
->assertEquals([
'core.entity_view_mode.node.full',
'flag.flag.following',
], View::load('flag_followers_content')
->getDependencies()['config']);
}
}