see #2735005: Convert all Simpletest web tests to BrowserTestBase (or UnitTestBase/KernelTestBase)
Lists of tests to convert

\Drupal\block_content\Tests\BlockContentCreationTest
\Drupal\block_content\Tests\BlockContentListTest
\Drupal\block_content\Tests\BlockContentListViewsTest
\Drupal\block_content\Tests\BlockContentTranslationUITest
\Drupal\block_content\Tests\BlockContentValidationTest

Views tests:
BlockContentFieldFilterTest.php
BlockContentIntegrationTest.php
BlockContentRedirectTest.php
BlockContentTestBase.php
FieldTypeTest.php
RevisionRelationshipsTest.php

Out of Scope:
\Drupal\block_content\Tests\BlockContentTypeTest #2887311: [PP-1] Convert web tests to browser tests for block_content module Part -2

Comments

GoZ created an issue. See original summary.

GoZ’s picture

Status: Active » Needs review
FileSize
9.07 KB

I don't convert BlockContentTestBase which needs first #2830773: Add legacy for clickLinkPartialName() method for browser tests to be fixed.

Status: Needs review » Needs work

The last submitted patch, 2: convert_web_tests_to-2864005-2.patch, failed testing.

GoZ’s picture

Status: Needs work » Needs review
FileSize
8.18 KB
729 bytes

Remove BlockContentUpdateTest.php from BTB conversion patch and put it back as WTB test since extends WTB methods.

dawehner’s picture

What is up with \Drupal\block_content\Tests\BlockContentTypeTest ?

dawehner’s picture

Status: Needs review » Needs work
Jo Fitzgerald’s picture

Status: Needs work » Needs review
FileSize
7.02 KB
809 bytes
  1. Moved \Drupal\block_content\Tests\BlockContentTypeTest.
  2. Removed (self-referencing) @deprecated from \Drupal\Tests\block_content\Functional\BlockContentTestBase.

Status: Needs review » Needs work

The last submitted patch, 7: 2864005-7.patch, failed testing.

dawehner’s picture

1) Drupal\Tests\block_content\Functional\BlockContentTypeTest::testBlockContentTypeEditing
Behat\Mink\Exception\ExpectationException: The string "Body" appears in the HTML response of this page, but it should not.

I guess this actually fetches the <body> tag?

michielnugter’s picture

Issue tags: +phpunit initiative
naveenvalecha’s picture

Status: Needs work » Needs review
FileSize
7.06 KB

Accommodated #9

This patch will fail with two errors

1) Drupal\Tests\block_content\Functional\BlockContentTypeTest::testBlockContentTypeEditing
Object of class Behat\Mink\Element\NodeElement could not be converted to string

/var/www/html/core/modules/system/src/Tests/Menu/AssertBreadcrumbTrait.php:102
/var/www/html/core/modules/system/src/Tests/Menu/AssertBreadcrumbTrait.php:61
/var/www/html/core/modules/system/src/Tests/Menu/AssertBreadcrumbTrait.php:39
/var/www/html/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php:126

The BlockContentTypeTest:: testBlockContentTypeEditing is using assertBreadcrumb which is part of the AssertBreadcrumbTrait This trait is also being used by the couple of Webtests. So Should we add another copy of AssertBreadcrumbTrait for BTB tests and change its functions accordingly?

2) Drupal\Tests\block_content\Functional\BlockContentTypeTest::testsBlockContentAddTypes
PHPUnit_Framework_Exception: Fatal error: Call to undefined method Drupal\Tests\block_content\Functional\BlockContentTypeTest::clickLinkPartialName() in /var/www/html/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php on line 207

Caused by
exception 'ErrorException' with message 'unserialize(): Error at offset 0 of 224 bytes' in /var/www/html/vendor/phpunit/phpunit/src/Util/PHP.php:114
Stack trace:
#0 [internal function]: PHPUnit_Util_PHP->{closure}(8, 'unserialize(): ...', '/var/www/html/v...', 114, Array)
#1 /var/www/html/vendor/phpunit/phpunit/src/Util/PHP.php(114): unserialize('\nFatal error: C...')
#2 /var/www/html/vendor/phpunit/phpunit/src/Util/PHP.php(52): PHPUnit_Util_PHP->processChildResult(Object(Drupal\Tests\block_content\Functional\BlockContentTypeTest), Object(PHPUnit_Framework_TestResult), '\nFatal error: C...', '')
#3 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php(722): PHPUnit_Util_PHP->runTestJob('

This class requires clickLinkPartialName function. In which class we're adding the new helper functions?

//Naveen

naveenvalecha’s picture

Title: Convert web tests to browser tests for block_content module » [PP-1] Convert web tests to browser tests for block_content module
Status: Needs review » Postponed
naveenvalecha’s picture

Title: [PP-1] Convert web tests to browser tests for block_content module » Convert web tests to browser tests for block_content module
Assigned: GoZ » Unassigned
Issue summary: View changes
Status: Postponed » Needs review
FileSize
6.36 KB
714 bytes

I have moved the \Drupal\block_content\Tests\BlockContentTypeTest to out of scope and added a followup issue to convert it #2887311: [PP-1] Convert web tests to browser tests for block_content module Part -2 and postponed the follow-up issue on the other issue so that we could proceed here with minimal disruption.

@Goz,
Thanks for the work that helped to keep this issue forward. I'm unassigning it as this issue is ready for review.

//Naveen

Lendude’s picture

Issue summary: View changes
Status: Needs review » Needs work

Looking good so far, the list to convert didn't have the Views tests in it yet, but we need to do these too.

naveenvalecha’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
13.28 KB
6.92 KB

Here we go with Views tests as well.

//Naveen

Lendude’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Patch looks good.

- Everything in scope is moved
- Deprecated base classes
- No tests in core that use the deprecated base classes except those we have a follow up for here.