function ConfigTest::testDefaultFile

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php \Drupal\Tests\Composer\Plugin\ProjectMessage\ConfigTest::testDefaultFile()
  2. 10 core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php \Drupal\Tests\Composer\Plugin\ProjectMessage\ConfigTest::testDefaultFile()
  3. 11.x core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php \Drupal\Tests\Composer\Plugin\ProjectMessage\ConfigTest::testDefaultFile()

@covers ::getText

File

core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php, line 77

Class

ConfigTest
@coversDefaultClass Drupal\Composer\Plugin\ProjectMessage\Message @group ProjectMessage

Namespace

Drupal\Tests\Composer\Plugin\ProjectMessage

Code

public function testDefaultFile() {
    // Root package has no extra field.
    $root = $this->getMockBuilder(RootPackageInterface::class)
        ->setMethods([
        'getExtra',
    ])
        ->getMockForAbstractClass();
    $root->expects($this->once())
        ->method('getExtra')
        ->willReturn([]);
    // The default is to try to read from event-name-message.txt, so we expect
    // config to try that.
    $message = $this->getMockBuilder(Message::class)
        ->setConstructorArgs([
        $root,
        'event-name',
    ])
        ->setMethods([
        'getMessageFromFile',
    ])
        ->getMock();
    $message->expects($this->once())
        ->method('getMessageFromFile')
        ->with('event-name-message.txt')
        ->willReturn([]);
    $this->assertSame([], $message->getText());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.