FlaggingStorageTest.php in Flag 8.4
File
tests/src/Kernel/FlaggingStorageTest.php
View source
<?php
namespace Drupal\Tests\flag\Kernel;
use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
use Drupal\Tests\node\Traits\NodeCreationTrait;
class FlaggingStorageTest extends FlagKernelTestBase {
use ContentTypeCreationTrait;
use NodeCreationTrait;
protected $account;
protected $flag;
protected $node;
protected function setUp() {
parent::setUp();
$this->account = $this
->createUser();
$this->flag = $this
->createFlag('node', [
'article',
]);
$this
->createContentType([
'type' => 'article',
]);
$this->node = $this
->createNode([
'type' => 'article',
]);
}
public function testCacheReset() {
$this->flagService
->flag($this->flag, $this->node, $this->account);
$this
->assertTrue($this->flag
->isFlagged($this->node, $this->account));
$this->flagService
->unflag($this->flag, $this->node, $this->account);
$this
->assertFalse($this->flag
->isFlagged($this->node, $this->account));
}
}