From ac4c3f1762790427bec96272bcac871860f4a218 Mon Sep 17 00:00:00 2001 From: Lauren Schaefer Date: Fri, 5 Oct 2018 12:31:00 -0400 Subject: [PATCH] Update the way we run our unit tests Fixes unit tests --- README.md | 15 ++---- .../tests/School/unit-php/phpunit.xml.dist | 53 ------------------- .../StudentGradebookJobTest.php | 0 .../gradebook_fake/RecordManagerTest.php | 0 .../base/api/OnlineApplicationsAPITest.php | 0 .../Contacts/Student_GradebookTest.php | 0 .../Fields/Forms/RatingFieldTest.php | 0 .../Fields/TemplateRatingFieldTest.php | 0 .../Leads/ApplicantProgrammingScoreTest.php | 0 scripts/RunProfMPHPUnitTests.sh | 4 +- 10 files changed, 6 insertions(+), 66 deletions(-) delete mode 100644 package/src/custom/tests/School/unit-php/phpunit.xml.dist rename package/src/custom/tests/{School/unit-php => unit-php/School}/Extension/modules/Schedulers/Ext/ScheduledTasks/StudentGradebookJobTest.php (100%) rename package/src/custom/tests/{School/unit-php => unit-php/School}/gradebook_fake/RecordManagerTest.php (100%) rename package/src/custom/tests/{School/unit-php => unit-php/School}/modules/Campaigns/clients/base/api/OnlineApplicationsAPITest.php (100%) rename package/src/custom/tests/{School/unit-php => unit-php/School}/modules/Contacts/Student_GradebookTest.php (100%) rename package/src/custom/tests/{School/unit-php => unit-php/School}/modules/DynamicFields/templates/Fields/Forms/RatingFieldTest.php (100%) rename package/src/custom/tests/{School/unit-php => unit-php/School}/modules/DynamicFields/templates/Fields/TemplateRatingFieldTest.php (100%) rename package/src/custom/tests/{School/unit-php => unit-php/School}/modules/Leads/ApplicantProgrammingScoreTest.php (100%) diff --git a/README.md b/README.md index fd4f8635..8f8f1472 100755 --- a/README.md +++ b/README.md @@ -662,7 +662,7 @@ Currently, we have PHPUnit tests and Postman tests. #### PHPUnit tests for the Professor M Module Loadable Package [PHPUnit](https://phpunit.de/) is a testing framework for PHP. The PHPUnit test files are located in -[package/src/custom/tests/School/unit-php](package/src/custom/tests/School/unit-php). +[package/src/custom/tests/unit-php/School](package/src/custom/tests/unit-php/School). ##### Manual execution @@ -698,7 +698,7 @@ for instructions on setting up a development environment. You will also need to get a copy of the Sugar provided unit tests and put them in your Sugar source code directory. See the [SugarCRM unit tests GitHub repo](https://github.com/sugarcrm/unit-tests) for more information. -Prepare to run the Sugar provided PHPUnit tests by executing the following commands: +Prepare to run the Sugar provided PHPUnit tests and the Professor M PHPUnit tests by executing the following commands: ``` $ cd /path/to/sugar_source_dir $ composer install @@ -717,17 +717,10 @@ Install the **standard** version of the Professor M Module Loadable Package usin if you have not already done so. The code for Professor M and the associated tests will be installed in to the Sugar source directory. -Prepare to run the Professor M PHPUnit tests by executing the following commands: -``` -$ cd /path/to/sugar_source_dir -$ cd custom/tests/School/unit-php -$ chmod +x ../../../../vendor/bin/phpunit -``` - -Run the Professor M PHPUnit tests by executing the following command from the `/custom/tests/School/unit-php` directory: +Run the Professor M PHPUnit tests by executing the following command from the `tests/unit-php` directory: ``` -$ ../../../../vendor/bin/phpunit +$ ../../vendor/bin/phpunit --testsuite custom ``` ##### Automatic execution in Travis CI diff --git a/package/src/custom/tests/School/unit-php/phpunit.xml.dist b/package/src/custom/tests/School/unit-php/phpunit.xml.dist deleted file mode 100644 index 48463e98..00000000 --- a/package/src/custom/tests/School/unit-php/phpunit.xml.dist +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - ./ - - - - - ../../.. - - ../.. - - - - - - - - diff --git a/package/src/custom/tests/School/unit-php/Extension/modules/Schedulers/Ext/ScheduledTasks/StudentGradebookJobTest.php b/package/src/custom/tests/unit-php/School/Extension/modules/Schedulers/Ext/ScheduledTasks/StudentGradebookJobTest.php similarity index 100% rename from package/src/custom/tests/School/unit-php/Extension/modules/Schedulers/Ext/ScheduledTasks/StudentGradebookJobTest.php rename to package/src/custom/tests/unit-php/School/Extension/modules/Schedulers/Ext/ScheduledTasks/StudentGradebookJobTest.php diff --git a/package/src/custom/tests/School/unit-php/gradebook_fake/RecordManagerTest.php b/package/src/custom/tests/unit-php/School/gradebook_fake/RecordManagerTest.php similarity index 100% rename from package/src/custom/tests/School/unit-php/gradebook_fake/RecordManagerTest.php rename to package/src/custom/tests/unit-php/School/gradebook_fake/RecordManagerTest.php diff --git a/package/src/custom/tests/School/unit-php/modules/Campaigns/clients/base/api/OnlineApplicationsAPITest.php b/package/src/custom/tests/unit-php/School/modules/Campaigns/clients/base/api/OnlineApplicationsAPITest.php similarity index 100% rename from package/src/custom/tests/School/unit-php/modules/Campaigns/clients/base/api/OnlineApplicationsAPITest.php rename to package/src/custom/tests/unit-php/School/modules/Campaigns/clients/base/api/OnlineApplicationsAPITest.php diff --git a/package/src/custom/tests/School/unit-php/modules/Contacts/Student_GradebookTest.php b/package/src/custom/tests/unit-php/School/modules/Contacts/Student_GradebookTest.php similarity index 100% rename from package/src/custom/tests/School/unit-php/modules/Contacts/Student_GradebookTest.php rename to package/src/custom/tests/unit-php/School/modules/Contacts/Student_GradebookTest.php diff --git a/package/src/custom/tests/School/unit-php/modules/DynamicFields/templates/Fields/Forms/RatingFieldTest.php b/package/src/custom/tests/unit-php/School/modules/DynamicFields/templates/Fields/Forms/RatingFieldTest.php similarity index 100% rename from package/src/custom/tests/School/unit-php/modules/DynamicFields/templates/Fields/Forms/RatingFieldTest.php rename to package/src/custom/tests/unit-php/School/modules/DynamicFields/templates/Fields/Forms/RatingFieldTest.php diff --git a/package/src/custom/tests/School/unit-php/modules/DynamicFields/templates/Fields/TemplateRatingFieldTest.php b/package/src/custom/tests/unit-php/School/modules/DynamicFields/templates/Fields/TemplateRatingFieldTest.php similarity index 100% rename from package/src/custom/tests/School/unit-php/modules/DynamicFields/templates/Fields/TemplateRatingFieldTest.php rename to package/src/custom/tests/unit-php/School/modules/DynamicFields/templates/Fields/TemplateRatingFieldTest.php diff --git a/package/src/custom/tests/School/unit-php/modules/Leads/ApplicantProgrammingScoreTest.php b/package/src/custom/tests/unit-php/School/modules/Leads/ApplicantProgrammingScoreTest.php similarity index 100% rename from package/src/custom/tests/School/unit-php/modules/Leads/ApplicantProgrammingScoreTest.php rename to package/src/custom/tests/unit-php/School/modules/Leads/ApplicantProgrammingScoreTest.php diff --git a/scripts/RunProfMPHPUnitTests.sh b/scripts/RunProfMPHPUnitTests.sh index 62229f88..fbb6db31 100755 --- a/scripts/RunProfMPHPUnitTests.sh +++ b/scripts/RunProfMPHPUnitTests.sh @@ -9,11 +9,11 @@ ###################################################################### # Change to the directory where the Sugar PHPUnit tests are stored and update permissions -docker exec sugar-web1 bash -c "cd custom/tests/School/unit-php && chmod +x ../../../../vendor/bin/phpunit" +docker exec sugar-web1 bash -c "cd tests/unit-php/ && chmod +x ../../vendor/bin/phpunit" ###################################################################### # Run the Professor M PHPUnit tests ###################################################################### echo "Running the PHPUnit tests for the Professor M Module Loadable Package..." -docker exec sugar-web1 bash -c "cd custom/tests/School/unit-php && ../../../../vendor/bin/phpunit" +docker exec sugar-web1 bash -c "cd tests/unit-php && ../../vendor/bin/phpunit --testsuite custom"