3 namespace Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Fixer;
5 use Drupal\drupalmoduleupgrader\Plugin\DMU\Fixer\Disable;
6 use Drupal\drupalmoduleupgrader\Plugin\DMU\Indexer\FunctionCalls;
7 use Drupal\Tests\drupalmoduleupgrader\Unit\TestBase;
12 * @TODO Add a test of the 'where' configuration option.
14 class DisableTest extends TestBase {
16 public function test() {
22 $this->dir->getChild('foo.module')->setContent(rtrim($code));
24 $indexer = new FunctionCalls([], 'function', ['exclude' => []], $this->db, $this->target);
29 ->get('plugin.manager.drupalmoduleupgrader.indexer')
30 ->method('createInstance')
31 ->with('function_call')
32 ->willReturn($indexer);
35 'type' => 'function_call',
36 'id' => 'variable_get',
37 'note' => 'This is no longer kosher!',
39 $plugin = new Disable($config, uniqID(), []);
40 $plugin->setTarget($this->target);
46 // This is no longer kosher!
47 // variable_get('foo');
50 // trim() makes the test pass. Go figure.
51 $this->assertEquals($expected, trim($this->dir->getChild('foo.module')->getContent()));