Phpunit is obviously the future of Drupal testing. Given that the existing tests aren't working properly at present, update to use phpunit and make them work.

Comments

rivimey created an issue. See original summary.

rivimey’s picture

StatusFileSize
new47.61 KB

First round of changes. Tests don't run to completion yet but do run:

cd web/core
cp phpunit.xml.dist phpunit.xml
[[edit phpunit.xml SIMPLETEST_BASE_URL, SIMPLETEST_DB, BROWSERTEST_OUTPUT_DIRECTORY ]]
phpunit ../modules/contrib/scheduled_updates/tests/

The patch removes the code starting 'if ($clone_field_options)' in AddFieldScheduledUpdateTypeTest.php because it really does require Ajax.

Many of the simpletest assert calls still use the 'AssertLegacy' shim and should be converted, but some have been.

Some 'throw \Exception' calls are now 'throw \LogicException' to be less generic but perhaps there are better options.

Some function docs comments have been improved but there is a lot of scope for further improvement.

rivimey’s picture

Assigned: rivimey » Unassigned
Status: Active » Needs work
tedbow’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new28.8 KB
new61.78 KB

I think we need to switch these to FunctionalJavascript tests. The module relies on a ton of ajax form stuff.

Here is a start. It gets \Drupal\Tests\scheduled_updates\FunctionalJavascript\EmbeddedScheduledUpdateTypeTest::testCreateType() to pass.

Though that function probably still needs work wait on elements appearing when we do an ajax submit via a button press or field change.
If we don't have proper waits then the test can start to fail randomly depending on how fast the actual test is running

I am not sure when I am going to get back to this issue hopefully this helps

  • rivimey committed 22bd40a on 8.x-1.x
    Issue #3146546 by tedbow, rivimey: Update tests to use phpunit
    
rivimey’s picture

Status: Needs review » Needs work

Added patch to swap tests over to get ball rolling.

smustgrave’s picture

Status: Needs work » Closed (outdated)

Going to close out to release the credit but working on updating the tests in #3518981: Setup gitlab and fix up pipeline

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.