3 namespace Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Fixer;
5 use Drupal\drupalmoduleupgrader\Plugin\DMU\Fixer\Notify;
6 use Drupal\Tests\drupalmoduleupgrader\Unit\TestBase;
7 use Pharborist\DocCommentNode;
8 use Pharborist\NodeCollection;
9 use Pharborist\Objects\ClassNode;
14 * @TODO Add a test of the 'where' configuration option.
16 class NotifyTest extends TestBase {
18 public function testDocComment() {
19 $class = ClassNode::create('Wambooli');
20 $class->setDocComment(DocCommentNode::create('Double wambooli!'));
21 $this->assertInstanceOf('\Pharborist\DocCommentNode', $class->getDocComment());
22 $indexer = $this->getMock('\Drupal\drupalmoduleupgrader\IndexerInterface');
23 $indexer->method('get')->with('Wambooli')->willReturn(new NodeCollection([ $class ]));
27 ->get('plugin.manager.drupalmoduleupgrader.indexer')
28 ->method('createInstance')
30 ->willReturn($indexer);
35 'note' => 'You need to rewrite this thing because I said so!',
37 $plugin = new Notify($config, uniqID(), []);
38 $plugin->setTarget($this->target);
41 $comment = $class->getDocComment();
42 $this->assertInstanceOf('\Pharborist\DocCommentNode', $comment);
46 You need to rewrite this thing because I said so!
48 $this->assertEquals($expected, $comment->getCommentText());