X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ffilter%2Ftests%2Fsrc%2FFunctional%2FFilterAdminTest.php;fp=web%2Fcore%2Fmodules%2Ffilter%2Fsrc%2FTests%2FFilterAdminTest.php;h=21431e7969a341f0f284d352f32d163215027aa0;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=aceeff56cc68acfc059a34520ce358a884b79d76;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/web/core/modules/filter/src/Tests/FilterAdminTest.php b/web/core/modules/filter/tests/src/Functional/FilterAdminTest.php similarity index 95% rename from web/core/modules/filter/src/Tests/FilterAdminTest.php rename to web/core/modules/filter/tests/src/Functional/FilterAdminTest.php index aceeff56c..21431e796 100644 --- a/web/core/modules/filter/src/Tests/FilterAdminTest.php +++ b/web/core/modules/filter/tests/src/Functional/FilterAdminTest.php @@ -1,13 +1,13 @@ xpath('//a[@href=:href]', [ ':href' => \Drupal::url('entity.filter_format.edit_form', ['filter_format' => $format_id]) ]); - $this->assertTrue($edit_link, format_string('Link href %href found.', + $this->assertNotEmpty($edit_link, format_string('Link href %href found.', ['%href' => 'admin/config/content/formats/manage/' . $format_id] )); $this->drupalGet('admin/config/content/formats/manage/' . $format_id); @@ -218,7 +218,7 @@ class FilterAdminTest extends WebTestBase { ':first' => 'filters[' . $first_filter . '][weight]', ':second' => 'filters[' . $second_filter . '][weight]', ]); - $this->assertTrue(!empty($elements), 'Order confirmed in admin interface.'); + $this->assertNotEmpty($elements, 'Order confirmed in admin interface.'); // Reorder filters. $edit = []; @@ -234,7 +234,7 @@ class FilterAdminTest extends WebTestBase { ':first' => 'filters[' . $second_filter . '][weight]', ':second' => 'filters[' . $first_filter . '][weight]', ]); - $this->assertTrue(!empty($elements), 'Reorder confirmed in admin interface.'); + $this->assertNotEmpty($elements, 'Reorder confirmed in admin interface.'); $filter_format = FilterFormat::load($restricted); foreach ($filter_format->filters() as $filter_name => $filter) { @@ -260,9 +260,9 @@ class FilterAdminTest extends WebTestBase { $format = FilterFormat::load($edit['format']); $this->assertNotNull($format, 'Format found in database.'); $this->drupalGet('admin/config/content/formats/manage/' . $format->id()); - $this->assertFieldByName('roles[' . RoleInterface::AUTHENTICATED_ID . ']', '', 'Role found.'); - $this->assertFieldByName('filters[' . $second_filter . '][status]', '', 'Line break filter found.'); - $this->assertFieldByName('filters[' . $first_filter . '][status]', '', 'URL filter found.'); + $this->assertSession()->checkboxChecked('roles[' . RoleInterface::AUTHENTICATED_ID . ']'); + $this->assertSession()->checkboxChecked('filters[' . $second_filter . '][status]'); + $this->assertSession()->checkboxChecked('filters[' . $first_filter . '][status]'); // Disable new filter. $this->drupalPostForm('admin/config/content/formats/manage/' . $format->id() . '/disable', [], t('Disable')); @@ -297,8 +297,8 @@ class FilterAdminTest extends WebTestBase { $this->assertText(t('Basic page @title has been created.', ['@title' => $edit['title[0][value]']]), 'Filtered node created.'); // Verify that the creation message contains a link to a node. - $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', [':href' => 'node/']); - $this->assert(isset($view_link), 'The message area contains a link to a node'); + $view_link = $this->xpath('//div[contains(@class, "messages")]//a[contains(@href, :href)]', [':href' => 'node/']); + $this->assertNotEmpty($view_link, 'The message area contains a link to a node'); $node = $this->drupalGetNodeByTitle($edit['title[0][value]']); $this->assertTrue($node, 'Node found in database.');