class ConfigTest
Same name in this branch
- 8.9.x core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\d8\ConfigTest
- 8.9.x core/modules/config/tests/config_test/src/Entity/ConfigTest.php \Drupal\config_test\Entity\ConfigTest
- 8.9.x core/modules/migrate/tests/src/Unit/destination/ConfigTest.php \Drupal\Tests\migrate\Unit\destination\ConfigTest
- 8.9.x core/modules/system/tests/src/Functional/File/ConfigTest.php \Drupal\Tests\system\Functional\File\ConfigTest
- 8.9.x core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php \Drupal\Tests\Composer\Plugin\VendorHardening\ConfigTest
- 8.9.x core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest
Same name in other branches
- 9 core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\d8\ConfigTest
- 9 core/modules/config/tests/config_test/src/Entity/ConfigTest.php \Drupal\config_test\Entity\ConfigTest
- 9 core/modules/migrate/tests/src/Unit/destination/ConfigTest.php \Drupal\Tests\migrate\Unit\destination\ConfigTest
- 9 core/modules/system/tests/src/Functional/File/ConfigTest.php \Drupal\Tests\system\Functional\File\ConfigTest
- 9 core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php \Drupal\Tests\Composer\Plugin\ProjectMessage\ConfigTest
- 9 core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php \Drupal\Tests\Composer\Plugin\VendorHardening\ConfigTest
- 9 core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest
- 10 core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\d8\ConfigTest
- 10 core/modules/config/tests/config_test/src/Entity/ConfigTest.php \Drupal\config_test\Entity\ConfigTest
- 10 core/modules/migrate/tests/src/Unit/destination/ConfigTest.php \Drupal\Tests\migrate\Unit\destination\ConfigTest
- 10 core/modules/system/tests/src/Functional/File/ConfigTest.php \Drupal\Tests\system\Functional\File\ConfigTest
- 10 core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php \Drupal\Tests\Composer\Plugin\ProjectMessage\ConfigTest
- 10 core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php \Drupal\Tests\Composer\Plugin\VendorHardening\ConfigTest
- 10 core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest
- 11.x core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\d8\ConfigTest
- 11.x core/modules/config/tests/config_test/src/Entity/ConfigTest.php \Drupal\config_test\Entity\ConfigTest
- 11.x core/modules/migrate/tests/src/Unit/destination/ConfigTest.php \Drupal\Tests\migrate\Unit\destination\ConfigTest
- 11.x core/modules/system/tests/src/Functional/File/ConfigTest.php \Drupal\Tests\system\Functional\File\ConfigTest
- 11.x core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php \Drupal\Tests\Composer\Plugin\ProjectMessage\ConfigTest
- 11.x core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php \Drupal\Tests\Composer\Plugin\VendorHardening\ConfigTest
- 11.x core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest
@coversDefaultClass Drupal\Composer\Plugin\ProjectMessage\Message @group ProjectMessage
Hierarchy
- class \Drupal\Tests\Composer\Plugin\ProjectMessage\ConfigTest extends \PHPUnit\Framework\TestCase
Expanded class hierarchy of ConfigTest
File
-
core/
tests/ Drupal/ Tests/ Composer/ Plugin/ ProjectMessage/ ConfigTest.php, line 14
Namespace
Drupal\Tests\Composer\Plugin\ProjectMessageView source
class ConfigTest extends TestCase {
public static function setUpBeforeClass() {
parent::setUpBeforeClass();
vfsStream::setup('config_test', NULL, [
'bespoke' => [
'special_file.txt' => "Special\nFile",
],
]);
}
public function provideGetMessageText() {
return [
[
[],
[],
],
[
[
'Special',
'File',
],
[
'drupal-core-project-message' => [
'event-name-file' => vfsStream::url('config_test/bespoke/special_file.txt'),
],
],
],
[
[
'I am the message.',
],
[
'drupal-core-project-message' => [
'event-name-message' => [
'I am the message.',
],
],
],
],
[
[
'This message overrides file.',
],
[
'drupal-core-project-message' => [
'event-name-message' => [
'This message overrides file.',
],
'event-name-file' => vfsStream::url('config_test/bespoke/special_file.txt'),
],
],
],
];
}
/**
* @dataProvider provideGetMessageText
* @covers ::getText
*/
public function testGetMessageText($expected, $config) {
// Root package has our config.
$root = $this->getMockBuilder(RootPackageInterface::class)
->setMethods([
'getExtra',
])
->getMockForAbstractClass();
$root->expects($this->once())
->method('getExtra')
->willReturn($config);
$message = new Message($root, 'event-name');
$this->assertSame($expected, $message->getText());
}
/**
* @covers ::getText
*/
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());
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ConfigTest::provideGetMessageText | public | function | |
ConfigTest::setUpBeforeClass | public static | function | |
ConfigTest::testDefaultFile | public | function | @covers ::getText |
ConfigTest::testGetMessageText | public | function | @dataProvider provideGetMessageText @covers ::getText |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.