X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fentity_browser%2Fsrc%2FTests%2FEntityBrowserUpdateHookTest.php;fp=web%2Fmodules%2Fcontrib%2Fentity_browser%2Fsrc%2FTests%2FEntityBrowserUpdateHookTest.php;h=e33ac1498d347f7bbff75bf225d0adad8da22c92;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/modules/contrib/entity_browser/src/Tests/EntityBrowserUpdateHookTest.php b/web/modules/contrib/entity_browser/src/Tests/EntityBrowserUpdateHookTest.php new file mode 100644 index 000000000..e33ac1498 --- /dev/null +++ b/web/modules/contrib/entity_browser/src/Tests/EntityBrowserUpdateHookTest.php @@ -0,0 +1,70 @@ +databaseDumpFiles = [ + DRUPAL_ROOT . '/core/modules/system/tests/fixtures/update/drupal-8.bare.standard.php.gz', + __DIR__ . '/../../tests/fixtures/update/entity_browser.update-hook-test.php', + ]; + } + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + $entity_browser_type = $this->container + ->get('entity_type.manager') + ->getDefinition('entity_browser'); + + $this->container + ->get('entity.last_installed_schema.repository') + ->setLastInstalledDefinition($entity_browser_type); + } + + /** + * {@inheritdoc} + */ + protected function doSelectionTest() { + parent::doSelectionTest(); + $this->assertRaw('8001 - Updates submit text for existing Entity browsers.'); + $this->assertRaw('8002 - Migrates duplicated Views entity_browser_select fields.'); + } + + /** + * Tests entity_browser_update_8001(). + */ + public function testSubmitTextUpdate() { + $this->runUpdates(); + $browser = $this->container->get('config.factory') + ->get('entity_browser.browser.test_update'); + + $this->assertNull($browser->get('submit_text'), 'Old submit text is gone'); + $this->assertEqual($browser->get('widgets.a4ad947c-9669-497c-9988-24351955a02f.settings.submit_text'), 'All animals are created equal','New submit text appears on the widget.'); + } + + /** + * Tests entity_browser_update_8002(). + */ + public function testViewsFieldUpdate() { + $this->runUpdates(); + $view = $this->container->get('config.factory') + ->get('views.view.test_deprecated_field'); + + $this->assertEqual($view->get('display.default.display_options.fields.entity_browser_select.table'), 'node', 'Data table in "entity_browser_select" replaced with data field.'); + } + +}