diff --git a/entity_print.install b/entity_print.install index ecfcb67..8e9960c 100644 --- a/entity_print.install +++ b/entity_print.install @@ -33,7 +33,7 @@ function entity_print_requirements($phase) { return $requirements; } - $definitions = \Drupal::service('plugin.manager.entity_print.pdf_engine')->getDefinitions(); + $definitions = \Drupal::service('plugin.manager.entity_print.print_engine')->getDefinitions(); $has_one_engine = FALSE; foreach ($definitions as $definition) { /** @var \Drupal\entity_print\Plugin\PdfEngineInterface $class */ diff --git a/entity_print.routing.yml b/entity_print.routing.yml index 5d076f9..90d0490 100644 --- a/entity_print.routing.yml +++ b/entity_print.routing.yml @@ -7,7 +7,7 @@ entity_print.view: _custom_access: '\Drupal\entity_print\Controller\EntityPrintController::checkAccess' entity_print.view.debug: - path: 'entityprint/{entity_type}/{entity_id}/debug' + path: 'entityprint/{export_type}/{entity_type}/{entity_id}/debug' defaults: _controller: '\Drupal\entity_print\Controller\EntityPrintController::viewPrintDebug' _title: 'Entity Print Debug' diff --git a/src/Tests/EntityPrintAdminTest.php b/src/Tests/EntityPrintAdminTest.php index 34b685c..957e34d 100644 --- a/src/Tests/EntityPrintAdminTest.php +++ b/src/Tests/EntityPrintAdminTest.php @@ -63,12 +63,12 @@ class EntityPrintAdminTest extends WebTestBase { $this->drupalPostForm(NULL, [], 'Save configuration'); // Assert the intial config values. - $this->drupalPostAjaxForm(NULL, ['pdf_engine' => 'testpdfengine'], 'pdf_engine'); + $this->drupalPostAjaxForm(NULL, ['pdf_engine' => 'testprintengine'], 'pdf_engine'); $this->assertFieldByName('test_engine_setting', 'initial value'); // Ensure the plugin gets the chance to validate the form. $this->drupalPostForm(NULL, [ - 'pdf_engine' => 'testpdfengine', + 'pdf_engine' => 'testprintengine', 'test_engine_setting' => 'rejected', ], 'Save configuration'); $this->assertText('Setting has an invalid value'); @@ -76,21 +76,21 @@ class EntityPrintAdminTest extends WebTestBase { $this->drupalPostForm(NULL, [ 'default_css' => 0, 'force_download' => 0, - 'pdf_engine' => 'testpdfengine', + 'pdf_engine' => 'testprintengine', 'test_engine_setting' => 'testvalue', ], 'Save configuration'); - /** @var \Drupal\entity_print\Entity\PdfEngineInterface $config_entity */ - $config_entity = \Drupal::entityTypeManager()->getStorage('pdf_engine')->load('testpdfengine'); + /** @var \Drupal\entity_print\Entity\PrintEngineInterface $config_entity */ + $config_entity = \Drupal::entityTypeManager()->getStorage('print_engine')->load('testprintengine'); // Assert the expected settings were stored. - $this->assertEqual('testpdfengine', $config_entity->id()); + $this->assertEqual('testprintengine', $config_entity->id()); $this->assertEqual(['test_engine_setting' => 'testvalue', 'test_engine_suffix' => 'overridden'], $config_entity->getSettings()); $this->assertEqual('entity_print_test', $config_entity->getDependencies()['module'][0]); - // Assert that the testpdfengine is actually used. - $this->drupalGet('/entityprint/node/1'); - $this->assertText('Using testpdfengine - overridden'); + // Assert that the testprintengine is actually used. + $this->drupalGet('/entityprint/pdf/node/1'); + $this->assertText('Using testprintengine - overridden'); } /** @@ -107,7 +107,7 @@ class EntityPrintAdminTest extends WebTestBase { // Ensure the link doesn't appear by default. $this->drupalGet($this->node->toUrl()); $this->assertNoText('View PDF'); - $this->assertNoLinkByHref('entityprint/node/1'); + $this->assertNoLinkByHref('entityprint/pdf/node/1'); // Save the default display with custom text. $random_text = $this->randomMachineName(); @@ -119,10 +119,10 @@ class EntityPrintAdminTest extends WebTestBase { // Visit our page node and ensure the link is available. $this->drupalGet($this->node->toUrl()); $this->assertLink($random_text); - $this->assertLinkByHref('/entityprint/node/1'); + $this->assertLinkByHref('/entityprint/pdf/node/1'); // Ensure we're using the full view mode and not the PDF view mode. - $this->drupalGet('/entityprint/node/1/debug'); + $this->drupalGet('/entityprint/pdf/node/1/debug'); $this->assertRaw('node--view-mode-full'); $this->assertNoRaw('node--view-mode-pdf'); @@ -136,7 +136,7 @@ class EntityPrintAdminTest extends WebTestBase { ], 'Save'); // Ensure the PDF view mode is now in use. - $this->drupalGet('/entityprint/node/1/debug'); + $this->drupalGet('/entityprint/pdf/node/1/debug'); $this->assertRaw('node--view-mode-pdf'); $this->assertNoRaw('node--view-mode-full'); diff --git a/tests/modules/entity_print_test/config/install/entity_print.pdf_engine.testpdfengine.yml b/tests/modules/entity_print_test/config/install/entity_print.pdf_engine.testpdfengine.yml deleted file mode 100644 index 7a5efb8..0000000 --- a/tests/modules/entity_print_test/config/install/entity_print.pdf_engine.testpdfengine.yml +++ /dev/null @@ -1,4 +0,0 @@ -id: testpdfengine -settings: - test_engine_setting: 'initial value' - test_engine_suffix: '' diff --git a/tests/modules/entity_print_test/config/schema/entity_print_test.schema.yml b/tests/modules/entity_print_test/config/schema/entity_print_test.schema.yml index dadcc56..4a73b8d 100644 --- a/tests/modules/entity_print_test/config/schema/entity_print_test.schema.yml +++ b/tests/modules/entity_print_test/config/schema/entity_print_test.schema.yml @@ -1,4 +1,4 @@ -entity_print_pdf_engine.testpdfengine: +entity_print_print_engine.testprintengine: type: mapping label: 'Test Pdf Engine setting' mapping: diff --git a/tests/modules/entity_print_test/src/EventSubscriber/TestEngineConfigurationAlter.php b/tests/modules/entity_print_test/src/EventSubscriber/TestEngineConfigurationAlter.php index e49db13..e1131d4 100644 --- a/tests/modules/entity_print_test/src/EventSubscriber/TestEngineConfigurationAlter.php +++ b/tests/modules/entity_print_test/src/EventSubscriber/TestEngineConfigurationAlter.php @@ -20,7 +20,7 @@ class TestEngineConfigurationAlter implements EventSubscriberInterface { * The event object. */ public function alterConfiguration(GenericEvent $event) { - if ($event->getArgument('config')->id() === 'testpdfengine') { + if ($event->getArgument('config')->id() === 'testprintengine') { $event->setArgument('configuration', ['test_engine_suffix' => 'overridden'] + $event->getArgument('configuration')); } } diff --git a/tests/modules/entity_print_test/src/Plugin/EntityPrint/PrintEngine/TestPrintEngine.php b/tests/modules/entity_print_test/src/Plugin/EntityPrint/PrintEngine/TestPrintEngine.php index 977ff68..68dda16 100644 --- a/tests/modules/entity_print_test/src/Plugin/EntityPrint/PrintEngine/TestPrintEngine.php +++ b/tests/modules/entity_print_test/src/Plugin/EntityPrint/PrintEngine/TestPrintEngine.php @@ -10,7 +10,7 @@ use Drupal\entity_print\Plugin\PrintEngineBase; * @PrintEngine( * id = "testprintengine", * label = @Translation("Test Print Engine"), - * export_type = 'pdf' + * export_type = "pdf" * ) */ class TestPrintEngine extends PrintEngineBase { diff --git a/tests/src/Unit/EntityPrintTest.php b/tests/src/Unit/EntityPrintTest.php index 72bab53..568a2da 100644 --- a/tests/src/Unit/EntityPrintTest.php +++ b/tests/src/Unit/EntityPrintTest.php @@ -10,7 +10,7 @@ namespace Drupal\Tests\entity_print\Unit; use Drupal\Tests\UnitTestCase; /** - * @coversDefaultClass \Drupal\entity_print\EntityPrintPdfBuilder + * @coversDefaultClass \Drupal\entity_print\PrintBuilder * @group entity_print */ class EntityPrintTest extends UnitTestCase { @@ -50,11 +50,11 @@ class EntityPrintTest extends UnitTestCase { /** * Get a mock pdf builder. * - * @return \Drupal\entity_print\EntityPrintPdfBuilder + * @return \Drupal\entity_print\PrintBuilder * The entity pdf builder mock. */ protected function getMockPdfBuilder() { - $pdf_builder = $this->getMockBuilder('Drupal\entity_print\EntityPrintPdfBuilder') + $pdf_builder = $this->getMockBuilder('Drupal\entity_print\PrintBuilder') ->disableOriginalConstructor() ->setMethods([]) ->getMock();