You are here

public function ConfigTest::testDefaultFile in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php \Drupal\Tests\Composer\Plugin\ProjectMessage\ConfigTest::testDefaultFile()
  2. 9 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)
    ->onlyMethods([
    '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',
  ])
    ->onlyMethods([
    'getMessageFromFile',
  ])
    ->getMock();
  $message
    ->expects($this
    ->once())
    ->method('getMessageFromFile')
    ->with('event-name-message.txt')
    ->willReturn([]);
  $this
    ->assertSame([], $message
    ->getText());
}