3 namespace Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Indexer;
5 use Drupal\Tests\drupalmoduleupgrader\Unit\TestBase;
8 * Base class for tests of DMU's indexer plugins. Because the indexers'
9 * behavior is so standard, this class reflects that by implementing a lot
10 * of standard assertions.
12 abstract class IndexerTestBase extends TestBase {
15 * @var \Drupal\drupalmoduleupgrader\IndexerInterface
19 public function testClear() {
20 $this->indexer->clear();
21 $this->assertCount(0, $this->indexer);
24 public function testHas() {
25 $this->assertTrue($this->indexer->has($this->info['class']['expectID'][0]));
26 $this->assertFalse($this->indexer->has(uniqID()));
29 public function testGet() {
30 $node = $this->indexer->get($this->info['class']['expectID'][0]);
32 $this->assertFalse($collection->isEmpty());
34 $this->assertInstanceOf($this->info['class']['expectType'][0], $node);
40 public function testDelete() {
41 $id = $this->info['class']['expectID'][0];
42 $this->indexer->delete($id);
43 $this->assertFalse($this->indexer->has($id));