Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-69206

test_get_content_items_by_name_pattern is too fragile.

    XMLWordPrintable

Details

    • MOODLE_310_STABLE, MOODLE_39_STABLE
    • MOODLE_39_STABLE
    • MDL-69206-master
    • Hide

      Prerequisite

      Test 1 (Unit tests)

      1. Setup phpunit (https://docs.moodle.org/dev/PHPUnit)
      2. In the terminal run

      vendor/bin/phpunit --colors "tests\course\services_content_item_service_testcase" course/tests/services_content_item_service_test.php
      

      * make sure the unit tests are successfully executed without any failures

      Test 2 (Behat tests)

      1. Setup behat (https://docs.moodle.org/dev/Running_acceptance_test)
      2. In the terminal run

      vendor/bin/behat --tags="@core_course"
      

      * make sure the behat tests are successfully executed without any failures

      Show
      Prerequisite Install " Turnitin's Moodle Direct v2 integration" activity module ( mod_turnitintooltwo ) from the Plugins directory ( https://moodle.org/plugins/mod_turnitintooltwo ) Test 1 (Unit tests) Setup phpunit ( https://docs.moodle.org/dev/PHPUnit ) In the terminal run vendor/bin/phpunit --colors "tests\course\services_content_item_service_testcase" course/tests/services_content_item_service_test.php * make sure the unit tests are successfully executed without any failures Test 2 (Behat tests) Setup behat ( https://docs.moodle.org/dev/Running_acceptance_test ) In the terminal run vendor/bin/behat --tags= "@core_course" * make sure the behat tests are successfully executed without any failures
    • 4.0 holding pattern 2

    Description

      test_get_content_items_by_name_pattern looks for the text "assign" and reports an error if it can find more than one item with that name.

      so... if you add "mod_turnitintooltwo" to the codebase which is referred to as "Turnitin assignment" this test now fails.

      this test should be modified to look for something that is guaranteed to be more unique.

       

      – failling test below –
      1) tests\course\services_content_item_service_testcase::test_get_content_items_by_name_pattern
      Failed asserting that actual size 2 matches expected size 1.
       
      /var/www/html/course/tests/services_content_item_service_test.php:157
      /var/www/html/lib/phpunit/classes/advanced_testcase.php:80
       
      To re-run:
      vendor/bin/phpunit --colors "tests\course\services_content_item_service_testcase" course/tests/services_content_item_service_test.php

      Attachments

        Issue Links

          Activity

            People

              Geshoski Mihail Geshoski
              danmarsden Dan Marsden
              Dan Marsden Dan Marsden
              Jake Dallimore Jake Dallimore
              Anna Carissa Sadia Anna Carissa Sadia
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                14/Sep/20

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours, 15 minutes
                  3h 15m