3 namespace Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Fixer;
5 use Drupal\drupalmoduleupgrader\Plugin\DMU\Fixer\Delete;
6 use Drupal\drupalmoduleupgrader\Plugin\DMU\Indexer\Functions;
7 use Drupal\Tests\drupalmoduleupgrader\Unit\TestBase;
12 * @TODO Add a test of the 'where' configuration option.
15 DeleteTest extends TestBase {
17 public function test() {
21 function foo_permission() {
24 'title' => 'Do snazzy bazzy things',
29 $this->dir->getChild('foo.module')->setContent($code);
31 $indexer = new Functions([], 'function', [], $this->db, $this->target);
36 ->get('plugin.manager.drupalmoduleupgrader.indexer')
37 ->method('createInstance')
39 ->willReturn($indexer);
43 'id' => 'hook_permission',
45 $plugin = new Delete($config, uniqid(), []);
46 $plugin->setTarget($this->target);
49 $this->assertFalse($indexer->has('permission'));
50 $this->assertEquals("<?php\n\n", $this->dir->getChild('foo.module')->getContent());