public function NotifyTest::testDocComment in Drupal 7 to 8/9 Module Upgrader 8
File
- tests/
src/ Unit/ Plugin/ DMU/ Fixer/ NotifyTest.php, line 18
Class
- NotifyTest
- @group DMU.Fixer
Namespace
Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\FixerCode
public function testDocComment() {
$class = ClassNode::create('Wambooli');
$class
->setDocComment(DocCommentNode::create('Double wambooli!'));
$this
->assertInstanceOf('\\Pharborist\\DocCommentNode', $class
->getDocComment());
$indexer = $this
->getMock('\\Drupal\\drupalmoduleupgrader\\IndexerInterface');
$indexer
->method('get')
->with('Wambooli')
->willReturn(new NodeCollection([
$class,
]));
$this->container
->get('plugin.manager.drupalmoduleupgrader.indexer')
->method('createInstance')
->with('class')
->willReturn($indexer);
$config = [
'type' => 'class',
'id' => 'Wambooli',
'note' => 'You need to rewrite this thing because I said so!',
];
$plugin = new Notify($config, uniqid(), []);
$plugin
->setTarget($this->target);
$plugin
->execute();
$comment = $class
->getDocComment();
$this
->assertInstanceOf('\\Pharborist\\DocCommentNode', $comment);
$expected = <<<END
Double wambooli!
You need to rewrite this thing because I said so!
END;
$this
->assertEquals($expected, $comment
->getCommentText());
}