Opigno LMS User manual


Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

1. Install PHPUnit and Selenium (for FunctionalJavascript tests);

  • you can install PHPUnit with Composer:

    composer require phpunit/phpunit
  • NOTE: For Selenium you need to install first npm. Then you can install Selenium with these commands:

    npm install selenium-standalone@latest -g
    selenium-standalone install
    • When Selenium is installed run command:

      selenium-standalone start
  • You need to apply this patch contrib-modules-issues-test-running.patch.zip (Our modules depend on many contrib modules and some of these modules have issues (which can be fixed in future))

2. Check PHPUnit configuration for testing:

  • Find core/phpunit.xml (if not exist just copy phpunit.xml.dist and rename to phpunit.xml)
  • In this file you need to specify these settings:

    <!-- Example SIMPLETEST_BASE_URL value: http://localhost -->
    <env name="SIMPLETEST_BASE_URL" value=""/>
    <!-- Example SIMPLETEST_DB value: mysql://username:password@localhost/databasename#table_prefix -->
    <env name="SIMPLETEST_DB" value=""/>
    <!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output -->
    <env name="BROWSERTEST_OUTPUT_DIRECTORY" value=""/>
  • For Selenium running you need to add this line in phpunit.xml:

    <env name="MINK_DRIVER_ARGS_WEBDRIVER" value='["chrome", null, "http://localhost:4444/wd/hub"]'/>

3. Run tests:

  • Run this test (for example):

    sudo -u www-data -E vendor/bin/phpunit -c core --group opigno_learning_path
    
    # Or the same with debug info:
    sudo -u www-data -E vendor/bin/phpunit -c core --group opigno_learning_path --printer="\Drupal\Tests\Listeners\HtmlOutputPrinter
  • No labels