Skip to content
This repository was archived by the owner on Apr 7, 2024. It is now read-only.

Add command for running project-specitic PHPUnit tests - #290

Open
janette wants to merge 4 commits into
masterfrom
custom-tests
Open

janette wants to merge 4 commits into
masterfrom
custom-tests

Conversation

@janette

@janette janette commented Apr 13, 2021 •

Copy link
Copy Markdown
Member

User Story:

When I write custom code for DKAN site, I want to be able to test it, to ensure against regression.

Acceptance Criteria:

I can run
dktl site:test:phpunit
dktl site:test:cypress
and the tests located in src directory will be run

Create commands above that will run corresponding tests

Estimate:

1 day

Notes:

phpunit.xml

<phpunit
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.6/phpunit.xsd"
    bootstrap="/var/www/vendor/weitzman/drupal-test-traits/src/bootstrap.php"
    colors="true"
    stopOnFailure="false"
    stopOnError="false"
    verbose="true">

    <testsuites>
        <testsuite name="Custom Test Suite">
            <directory>my_module/tests/src/ExistingSite/TestName.php</directory>
        </testsuite>
    </testsuites>

    <php>
        <!-- These variables may alternatively be set as environment variables. -->
        <!-- E.g., `DRUPAL_VERSION=V8 ./vendor/bin/phpunit` -->
        <env name="DRUPAL_VERSION" value="V8"/>
        <env name="DTT_BASE_URL" value="http://web"/>
        <env name="SIMPLETEST_BASE_URL" value="http://web"/>
        <env name="SIMPLETEST_DB" value="mysql://drupal:123@db/drupal"/>
    </php>
</phpunit>
  • Add phpunit.xml to src/modules
  • Run dktl custom:test-phpunit --testsuite "Custom Test Suite"

@janette
janette requested a review from dafeder May 19, 2021 19:42
@dafeder dafeder changed the title Add command for running custom tests Add command for running project-specitic PHPUnit tests Jun 21, 2021
@dafeder dafeder self-assigned this Jun 21, 2021

@dafeder dafeder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@janette I think we shouldn't call it CustomCommands because that's the same name we recommend people use for commands in a project src/command. How about "site"? dktl site:test-cypress seems like a good counterpart to "dkan".

@dafeder dafeder assigned janette and unassigned dafeder Jun 25, 2021
@dafeder

dafeder commented Jun 25, 2021

Copy link
Copy Markdown
Member

Also, there should really be tests for these... let's discuss we can make a separate ticket for those if not feasible for this PR.

@dafeder dafeder linked an issue Oct 1, 2021 that may be closed by this pull request

This branch has not been deployed

No deployments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document and complete project-specific test commands

4 participants