Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.6
    • Component/s: Unit tests
    • Labels:
      None
    • Testing Instructions:
      Hide

      1/ Execute individual phpunit tests in linux/mac

      You may need to build new configs first:

      php admin/tool/phpunit/cli/util.php --buildcomponentconfigs
      php admin/tool/phpunit/cli/util.php --buildconfig
      

      Some test with proper frankenstyle which supports autoloading (must work):

      vendor/bin/phpunit core_component_testcase
      vendor/bin/phpunit core_component_testcase lib/tests/component_test.php
      vendor/bin/phpunit lib/tests/component_test.php
      

      Some incorrectly named testcase (must work):

      vendor/bin/phpunit collatorlib_testcase lib/tests/textlib_test.php
      

      Some "broken" test file with multiple testacses (must fail):

      vendor/bin/phpunit lib/tests/textlib_test.php
      

      2/ repeat in windows, please note both / and \ should be now supported in relative paths

      vendor\bin\phpunit.bat core_component_testcase
      vendor\bin\phpunit.bat core_component_testcase lib\tests\component_test.php
      vendor\bin\phpunit.bat core_component_testcase lib/tests/component_test.php
      vendor\bin\phpunit.bat lib/tests/component_test.php
      vendor\bin\phpunit.bat lib\tests\component_test.php
      

      Show
      1/ Execute individual phpunit tests in linux/mac You may need to build new configs first: php admin/tool/phpunit/cli/util.php --buildcomponentconfigs php admin/tool/phpunit/cli/util.php --buildconfig Some test with proper frankenstyle which supports autoloading (must work): vendor/bin/phpunit core_component_testcase vendor/bin/phpunit core_component_testcase lib/tests/component_test.php vendor/bin/phpunit lib/tests/component_test.php Some incorrectly named testcase (must work): vendor/bin/phpunit collatorlib_testcase lib/tests/textlib_test.php Some "broken" test file with multiple testacses (must fail): vendor/bin/phpunit lib/tests/textlib_test.php 2/ repeat in windows, please note both / and \ should be now supported in relative paths vendor\bin\phpunit.bat core_component_testcase vendor\bin\phpunit.bat core_component_testcase lib\tests\component_test.php vendor\bin\phpunit.bat core_component_testcase lib/tests/component_test.php vendor\bin\phpunit.bat lib/tests/component_test.php vendor\bin\phpunit.bat lib\tests\component_test.php
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w26_MDL-40305_m26_phpunitloader

      Description

      phpunit should be able to find the file where is the testcase defined automatically...

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            skodak Petr Skoda added a comment - - edited

            1/ test execution of unit tests:

            php admin/tool/phpunit/cli/util.php --buildcomponentconfigs
            php admin/tool/phpunit/cli/util.php --buildconfig
             
            vendor/bin/phpunit --colors lib/tests/component_test.php
            vendor/bin/phpunit --colors core_component_testcase
            vendor/bin/phpunit --colors core_component_testcase lib/tests/component_test.php
             
            vendor/bin/phpunit --colors lib/tests/textlib_test.php 
            

            The last one should complain about multiple testcases (unless my core_text patch gets accepted).

            Show
            skodak Petr Skoda added a comment - - edited 1/ test execution of unit tests: php admin/tool/phpunit/cli/util.php --buildcomponentconfigs php admin/tool/phpunit/cli/util.php --buildconfig   vendor/bin/phpunit --colors lib/tests/component_test.php vendor/bin/phpunit --colors core_component_testcase vendor/bin/phpunit --colors core_component_testcase lib/tests/component_test.php   vendor/bin/phpunit --colors lib/tests/textlib_test.php The last one should complain about multiple testcases (unless my core_text patch gets accepted).
            Hide
            skodak Petr Skoda added a comment -

            I need to test/fix this for windows too...

            Show
            skodak Petr Skoda added a comment - I need to test/fix this for windows too...
            Hide
            skodak Petr Skoda added a comment -

            Fixed windows support, I suppose this can go safely to master, if anything fails we can simple undo the line in phpunit xml dist file...

            Show
            skodak Petr Skoda added a comment - Fixed windows support, I suppose this can go safely to master, if anything fails we can simple undo the line in phpunit xml dist file...
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            +1

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - +1
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Gets a +1 from me as well, a natural move given we've now got class autoloading.

            Has been integrated now.

            Many thanks
            Sam

            Show
            samhemelryk Sam Hemelryk added a comment - Gets a +1 from me as well, a natural move given we've now got class autoloading. Has been integrated now. Many thanks Sam
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Thanks Petr - tested and passed

            Show
            samhemelryk Sam Hemelryk added a comment - Thanks Petr - tested and passed
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Thanks for giving me joys and smiles
            Thanks for sharing my trouble's pile

            Thanks for wipeing the tears of my eye
            Thanks for showing me the glad view of sky

            Thanks for lending me your shoulders to lean
            Thanks for giving my words a proper mean

            Thanks for telling me the value of life
            Thanks for showing me the rules to survive

            Thanks for lending me the sympathetic ears
            Thanks for showing how much you care

            From all this what I mean in the end
            Is thanks for being my special friend.

            – Seema Chowdhury

            Sent upstream so... closing, thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Thanks for giving me joys and smiles Thanks for sharing my trouble's pile Thanks for wipeing the tears of my eye Thanks for showing me the glad view of sky Thanks for lending me your shoulders to lean Thanks for giving my words a proper mean Thanks for telling me the value of life Thanks for showing me the rules to survive Thanks for lending me the sympathetic ears Thanks for showing how much you care From all this what I mean in the end Is thanks for being my special friend. – Seema Chowdhury Sent upstream so... closing, thanks!

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

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