Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / entity / tests / src / Functional / Menu / EntityLocalActionTest.php
diff --git a/web/modules/contrib/entity/tests/src/Functional/Menu/EntityLocalActionTest.php b/web/modules/contrib/entity/tests/src/Functional/Menu/EntityLocalActionTest.php
new file mode 100644 (file)
index 0000000..4fb4faa
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+
+namespace Drupal\Tests\entity\Functional\Menu;
+
+use Drupal\Tests\BrowserTestBase;
+
+/**
+ * Tests that entity local actions are generated correctly.
+ *
+ * @group entity
+ *
+ * @runTestsInSeparateProcesses
+ *
+ * @preserveGlobalState disabled
+ */
+class EntityLocalActionTest extends BrowserTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected static $modules = ['block', 'entity', 'entity_module_test'];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+
+    $this->drupalPlaceBlock('local_actions_block');
+
+    $account = $this->drupalCreateUser(['administer entity_test_enhanced']);
+    $this->drupalLogin($account);
+  }
+
+  /**
+   * Tests the local action on the collection is provided correctly.
+   */
+  public function testCollectionLocalAction() {
+    $this->drupalGet('/entity_test_enhanced');
+    $this->assertSession()->linkByHrefExists('/entity_test_enhanced/add');
+    $this->assertSession()->linkExists('Add enhanced entity');
+  }
+
+}