Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / tests / src / Unit / Plugin / DMU / Indexer / IndexerTestBase.php
1 <?php
2
3 namespace Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Indexer;
4
5 use Drupal\Tests\drupalmoduleupgrader\Unit\TestBase;
6
7 /**
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.
11  */
12 abstract class IndexerTestBase extends TestBase {
13
14   /**
15    * @var \Drupal\drupalmoduleupgrader\IndexerInterface
16    */
17   protected $indexer;
18
19   public function testClear() {
20     $this->indexer->clear();
21     $this->assertCount(0, $this->indexer);
22   }
23
24   public function testHas() {
25     $this->assertTrue($this->indexer->has($this->info['class']['expectID'][0]));
26     $this->assertFalse($this->indexer->has(uniqID()));
27   }
28
29   public function testGet() {
30     $node = $this->indexer->get($this->info['class']['expectID'][0]);
31
32     $this->assertFalse($collection->isEmpty());
33
34     $this->assertInstanceOf($this->info['class']['expectType'][0], $node);
35   }
36
37   /**
38    * @depends testHas
39    */
40   public function testDelete() {
41     $id = $this->info['class']['expectID'][0];
42     $this->indexer->delete($id);
43     $this->assertFalse($this->indexer->has($id));
44   }
45
46 }