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

Unit tests for httpsreplace do not respect external test URL

    XMLWordPrintable

    Details

      Description

      Defining TEST_EXTERNAL_FILES_HTTP_URL allows us to use an alternative to download.moodle.org, but there are some locations where this does not happen:

      2050 moodle-docker:exttests> bin/moodle-docker-compose exec webserver php vendor/bin/phpunit admin/tool/httpsreplace/tests/httpsreplace_test.php
      Moodle 3.5dev (Build: 20171201), 5f54a8760f2821c12bd90beaa37b9fa937f101e6
      Php: 7.1.9, pgsql: 9.6.5, OS: Linux 4.9.49-moby x86_64
      PHPUnit 6.4.4 by Sebastian Bergmann and contributors.
       
      FF.....F.F..F.............                                        26 / 26 (100%)
       
      Time: 37.09 seconds, Memory: 40.00MB
       
      There were 5 failures:
       
      1) tool_httpsreplace\tests\httpsreplace_test::test_upgrade_http_links with data set "Test image from another site should be replaced" ('<img src="http://exttests/test.jpg">', '/UPDATE/', '<img src="https://download.mo....jpg">')
      Failed asserting that '<img src="https://exttests/test.jpg">' contains "<img src="https://download.moodle.org/unittest/test.jpg">".
       
      /var/www/html/admin/tool/httpsreplace/tests/httpsreplace_test.php:144
      /var/www/html/lib/phpunit/classes/advanced_testcase.php:80
       
      To re-run:
       vendor/bin/phpunit tool_httpsreplace\tests\httpsreplace_test admin/tool/httpsreplace/tests/httpsreplace_test.php
       
      2) tool_httpsreplace\tests\httpsreplace_test::test_upgrade_http_links with data set "Test object from another site should be replaced" ('<object data="http://exttests....swf">', '/UPDATE/', '<object data="https://downloa....swf">')
      Failed asserting that '<object data="https://exttests/test.swf">' contains "<object data="https://download.moodle.org/unittest/test.swf">".
       
      /var/www/html/admin/tool/httpsreplace/tests/httpsreplace_test.php:144
      /var/www/html/lib/phpunit/classes/advanced_testcase.php:80
       
      To re-run:
       vendor/bin/phpunit tool_httpsreplace\tests\httpsreplace_test admin/tool/httpsreplace/tests/httpsreplace_test.php
       
      3) tool_httpsreplace\tests\httpsreplace_test::test_upgrade_http_links with data set "Search for params should be case insensitive" ('<object DATA="http://exttests....swf">', '/UPDATE/', '<object DATA="https://downloa....swf">')
      Failed asserting that '<object DATA="https://exttests/test.swf">' contains "<object DATA="https://download.moodle.org/unittest/test.swf">".
       
      /var/www/html/admin/tool/httpsreplace/tests/httpsreplace_test.php:144
      /var/www/html/lib/phpunit/classes/advanced_testcase.php:80
       
      To re-run:
       vendor/bin/phpunit tool_httpsreplace\tests\httpsreplace_test admin/tool/httpsreplace/tests/httpsreplace_test.php
       
      4) tool_httpsreplace\tests\httpsreplace_test::test_upgrade_http_links with data set "More params should not interfere" ('<img alt="A picture" src="htt..."></p>', '/UPDATE/', '<img alt="A picture" src="htt..."></p>')
      Failed asserting that '<img alt="A picture" src="https://exttests/test.png" width="1”><p style="font-size: '20px'"></p>' contains "<img alt="A picture" src="https://download.moodle.org/unittest/test.png" width="1”><p style="font-size: '20px'"></p>".
       
      /var/www/html/admin/tool/httpsreplace/tests/httpsreplace_test.php:144
      /var/www/html/lib/phpunit/classes/advanced_testcase.php:80
       
      To re-run:
       vendor/bin/phpunit tool_httpsreplace\tests\httpsreplace_test admin/tool/httpsreplace/tests/httpsreplace_test.php
       
      5) tool_httpsreplace\tests\httpsreplace_test::test_upgrade_http_links with data set "Test image from another site should be replaced but link should not" ('<a href="http://exttests/test..."></a>', '/UPDATE/', '<a href="http://exttests/test..."></a>')
      Failed asserting that '<a href="http://exttests/test.png"><img src="https://exttests/test.jpg"></a>' contains "<a href="http://exttests/test.png"><img src="https://download.moodle.org/unittest/test.jpg"></a>".
       
      /var/www/html/admin/tool/httpsreplace/tests/httpsreplace_test.php:144
      /var/www/html/lib/phpunit/classes/advanced_testcase.php:80
       
      To re-run:
       vendor/bin/phpunit tool_httpsreplace\tests\httpsreplace_test admin/tool/httpsreplace/tests/httpsreplace_test.php
       
      FAILURES!
      Tests: 26, Assertions: 52, Failures: 5.
      

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/Nov/17