public function PrintFormatTest::testSetConfiguration in Printer and PDF versions for Drupal 8+ 8
Same name and namespace in other branches
- 2.x tests/src/Unit/Plugin/PrintableFormat/PrintFormatTest.php \Drupal\Tests\printable\Unit\Plugin\PrintableFormat\PrintFormatTest::testSetConfiguration()
Test that default configuration can be modified and changes accessed.
@covers PrintFormat::SetConfiguration
File
- tests/
src/ Unit/ Plugin/ PrintableFormat/ PrintFormatTest.php, line 118
Class
- PrintFormatTest
- Tests the print format plugin.
Namespace
Drupal\Tests\printable\Unit\Plugin\PrintableFormatCode
public function testSetConfiguration() {
$new_configuration = [
'show_print_dialogue' => FALSE,
];
$config_mock = $this
->getMockBuilder('\\Drupal\\Core\\Config\\Config')
->disableOriginalConstructor()
->getMock();
$config_mock
->expects($this
->once())
->method('set')
->with('print', $new_configuration)
->will($this
->returnSelf());
$config_mock
->expects($this
->once())
->method('save');
$config_factory_mock = $this
->getMockBuilder('\\Drupal\\Core\\Config\\ConfigFactory')
->disableOriginalConstructor()
->getMock();
$config_factory_mock
->expects($this
->once())
->method('get')
->with('printable.format')
->will($this
->returnValue($config_mock));
$format = new PrintFormat($this->configuration, $this->pluginId, $this->pluginDefinition, $config_factory_mock, $this
->getCssIncludeStub(), $this
->getLinkExtractorIncludeStub());
$format
->setConfiguration($new_configuration);
$this
->assertEquals($new_configuration, $format
->getConfiguration());
}