Unexpected output: Other revisions:Array ( [494] => DifferentialRevision Object ( [title:protected] => INP-1863 - Correct PHPUnit integration [status:protected] => needs-review [summary:protected] => [testPlan:protected] => IMPORTANT: Apply patch using `arc patch D494` command, because the Phabricator-generated patch doesn't correctly display file moves, that have no content changes. # Preparations 1. if you don't have Selenium Server installed, then install it using instructions from the `Preparations` section of the D451 2. in IDE: * in the `core/tests/Functional` folder create `CoreWorkflowTest.php` file with this content: ``` <?php class CoreWorkflowTest extends AbstractBrowserTestCase { public function testSample() { $session = $this->getSession(); $url = $this->Application->HREF('platform/login/register', '', array('no_amp' => 1)); $session->visit($url); $this->assertTrue(true); } } ``` 3. remove contents of the `core/units/helpers/xml_helper.php` and `core/units/helpers/xml_helper5.php` files 4. in the "tools/build/targets/common.xml" file add these lines after `<arg path="${phpunit.config.file}"/>` line (4 places) `<arg value="--testdox"/>` line 5. in the `tools/run_event.php` file comment out the `exit_code(1, 'This script needs to be enabled manually !');` line 6. in CLI: * run the `composer install` command, to actualize `vendor` folder content * ~~run the `phing -f tools/build/build_custom.xml db-dump` command to create a dump~~ * ~~for each of the `build-*.sql` files created in the `system` directory:~~ * ~~remove the `mysqldump: [Warning] Using a password on the command line interface can be insecure.` line (if found)~~ * ~~save changes~~ # Part 1 - the PHPUnit isn't used in the default build workflow # delete the "build" folder # run the `phing -f tools/build/build_all.xml build` command # confirm, by looking at the colorized output of the above command, that `phpunit-ci` or `phpunit` targets weren't called # delete the "build" folder # run the `phing -f tools/build/build_custom.xml build` command # confirm, by looking at the colorized output of the above command, that `phpunit-ci` or `phpunit` targets weren't called # Part 2 - core test suite structure testing (via phpunit itself) 1. run the `vendor/bin/phpunit -c tools/build/inc/phpunit.xml --testdox` command 2. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: .../tools/build/inc/phpunit.xml kFormatter ... SampleUnit ... CoreWorkflow ... SampleWorkflow ... ``` 3. run the `vendor/bin/phpunit -c tools/build/inc/phpunit.xml --testdox --testsuite Unit` command 4. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: .../tools/build/inc/phpunit.xml kFormatter ... SampleUnit ... ``` 5. run the `vendor/bin/phpunit -c tools/build/inc/phpunit.xml --testdox --testsuite Functional` command 6. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: .../tools/build/inc/phpunit.xml CoreWorkflow ... SampleWorkflow ... ``` # Part 3 - custom test suite structure testing (via phpunit itself) 1. run the `vendor/bin/phpunit -c tools/build/inc/custom_phpunit.xml --testdox` command 2. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: .../tools/build/inc/phpunit.xml SampleUnit ... SampleWorkflow ... ``` 3. run the `vendor/bin/phpunit -c tools/build/inc/custom_phpunit.xml --testdox --testsuite Unit` command 4. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: .../tools/build/inc/phpunit.xml SampleUnit ... ``` 5. run the `vendor/bin/phpunit -c tools/build/inc/custom_phpunit.xml --testdox --testsuite Functional` command 6. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: .../tools/build/inc/phpunit.xml SampleWorkflow ... ``` # Part 4 - core test suite structure testing (via phing's "phpunit" task) 1. delete the "build" folder 2. run the `phing -f tools/build/build_all.xml phpunit` command 3. confirm, that "build/logs/clover.xml" and "build/logs/junit.xml" files doesn't exist 4. confirm, by looking at the colorized output of the above command, that `phpunit` target was called 5. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: /mnt/UserData/home/alex/web/d/in-portal.52x/tools/build/inc/phpunit.xml kFormatter ... SampleUnit ... CoreWorkflow ... SampleWorkflow ... ``` 6. delete the "build" folder 7. run the `phing -f tools/build/build_all.xml phpunit -Dphpunit.testsuite=Unit` command 8. confirm, that "build/logs/clover.xml" and "build/logs/junit.xml" files doesn't exist 9. confirm, by looking at the colorized output of the above command, that `phpunit` target was called 10. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: /mnt/UserData/home/alex/web/d/in-portal.52x/tools/build/inc/phpunit.xml kFormatter ... SampleUnit ... ``` 11. delete the "build" folder 12. run the `phing -f tools/build/build_all.xml phpunit -Dphpunit.testsuite=Functional` command 13. confirm, that "build/logs/clover.xml" and "build/logs/junit.xml" files doesn't exist 14. confirm, by looking at the colorized output of the above command, that `phpunit` target was called 15. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: /mnt/UserData/home/alex/web/d/in-portal.52x/tools/build/inc/phpunit.xml CoreWorkflow ... SampleWorkflow ... ``` # Part 5 - core test suite structure testing (via phing's "phpunit-ci" task) 1. delete the "build" folder 2. run the `phing -f tools/build/build_all.xml phpunit-ci` command 3. confirm, that "build/logs/clover.xml" and "build/logs/junit.xml" files were created and they're not empty 4. confirm, by looking at the colorized output of the above command, that `phpunit-ci` target was called 5. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: /mnt/UserData/home/alex/web/d/in-portal.52x/tools/build/inc/phpunit.xml kFormatter ... SampleUnit ... CoreWorkflow ... SampleWorkflow ... Generating code coverage report in Clover XML format ... done ``` 6. delete the "build" folder 7. run the `phing -f tools/build/build_all.xml phpunit-ci -Dphpunit.testsuite=Unit` command 8. confirm, that "build/logs/clover.xml" and "build/logs/junit.xml" files were created and they're not empty 9. confirm, by looking at the colorized output of the above command, that `phpunit-ci` target was called 10. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: /mnt/UserData/home/alex/web/d/in-portal.52x/tools/build/inc/phpunit.xml kFormatter ... SampleUnit ... Generating code coverage report in Clover XML format ... done ``` 11. delete the "build" folder 12. run the `phing -f tools/build/build_all.xml phpunit-ci -Dphpunit.testsuite=Functional` command 13. confirm, that "build/logs/clover.xml" and "build/logs/junit.xml" files were created and they're not empty 14. confirm, by looking at the colorized output of the above command, that `phpunit-ci` target was called 15. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: /mnt/UserData/home/alex/web/d/in-portal.52x/tools/build/inc/phpunit.xml CoreWorkflow ... SampleWorkflow ... Generating code coverage report in Clover XML format ... done ``` # Part 6 - custom test suite structure testing (via phing's "phpunit" task) 1. delete the "build" folder 2. run the `phing -f tools/build/build_custom.xml phpunit` command 3. confirm, that "build/logs/clover.xml" and "build/logs/junit.xml" files doesn't exist 4. confirm, by looking at the colorized output of the above command, that `phpunit` target was called 5. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: /mnt/UserData/home/alex/web/d/in-portal.52x/tools/build/inc/custom_phpunit.xml SampleUnit ... SampleWorkflow ... ``` 6. delete the "build" folder 7. run the `phing -f tools/build/build_custom.xml phpunit -Dphpunit.testsuite=Unit` command 8. confirm, that "build/logs/clover.xml" and "build/logs/junit.xml" files doesn't exist 9. confirm, by looking at the colorized output of the above command, that `phpunit` target was called 10. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: /mnt/UserData/home/alex/web/d/in-portal.52x/tools/build/inc/custom_phpunit.xml SampleUnit ... ``` 11. delete the "build" folder 12. run the `phing -f tools/build/build_custom.xml phpunit -Dphpunit.testsuite=Functional` command 13. confirm, that "build/logs/clover.xml" and "build/logs/junit.xml" files doesn't exist 14. confirm, by looking at the colorized output of the above command, that `phpunit` target was called 15. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: /mnt/UserData/home/alex/web/d/in-portal.52x/tools/build/inc/custom_phpunit.xml SampleWorkflow ... ``` # Part 7 - custom test suite structure testing (via phing's "phpunit-ci" task) 1. delete the "build" folder 2. run the `phing -f tools/build/build_custom.xml phpunit-ci` command 3. confirm, that "build/logs/clover.xml" and "build/logs/junit.xml" files were created and they're not empty 4. confirm, by looking at the colorized output of the above command, that `phpunit-ci` target was called 5. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: /mnt/UserData/home/alex/web/d/in-portal.52x/tools/build/inc/custom_phpunit.xml SampleUnit ... SampleWorkflow ... Generating code coverage report in Clover XML format ... done ``` 6. delete the "build" folder 7. run the `phing -f tools/build/build_custom.xml phpunit-ci -Dphpunit.testsuite=Unit` command 8. confirm, that "build/logs/clover.xml" and "build/logs/junit.xml" files were created and they're not empty 9. confirm, by looking at the colorized output of the above command, that `phpunit-ci` target was called 10. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: /mnt/UserData/home/alex/web/d/in-portal.52x/tools/build/inc/custom_phpunit.xml SampleUnit ... Generating code coverage report in Clover XML format ... done ``` 11. delete the "build" folder 12. run the `phing -f tools/build/build_custom.xml phpunit-ci -Dphpunit.testsuite=Functional` command 13. confirm, that "build/logs/clover.xml" and "build/logs/junit.xml" files were created and they're not empty 14. confirm, by looking at the colorized output of the above command, that `phpunit-ci` target was called 15. confirm, that the output looks similar to this: ``` PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.40 with Xdebug 2.5.5 Configuration: /mnt/UserData/home/alex/web/d/in-portal.52x/tools/build/inc/custom_phpunit.xml SampleWorkflow ... Generating code coverage report in Clover XML format ... done ``` # Testing (part 8 - the "/system/mink_config.php" requirement) # move the "mink_config.php" file away from the "/system" folder # run the `vendor/bin/phpunit -c tools/build/inc/phpunit.xml` command # confirm, that command now fails with "The Mink configuration file does not exist." message (via thrown exception) # move the "mink_config.php" file back to "/system" folder [authorPHID:protected] => PHID-USER-pzgnjqvehwzwo6lmf56l [lastReviewerPHID:protected] => [lineCount:protected] => 522 [attached:protected] => Array ( ) [mailKey:protected] => iftuea6okcfkh5omo43lyzxqvzbu2w7kab5mpmjx [branchName:protected] => [repositoryPHID:protected] => PHID-REPO-e2gijwty5qkn653ecnc2 [activeDiffPHID:protected] => PHID-DIFF-5c5ups4fbwxokuzoykmd [viewPolicy:protected] => public [editPolicy:protected] => users [properties:protected] => Array ( [draft.broadcast] => 1 [lines.added] => 126 [lines.removed] => 396 [buildables] => Array ( [PHID-HMBB-ab5vax4z65skrph4yp5o] => Array ( [status] => passed ) [PHID-HMBB-i4x7ob3zxplc4ybsdaho] => Array ( [status] => passed ) [PHID-HMBB-5lnht3few52ee7s4wewr] => Array ( [status] => passed ) [PHID-HMBB-cbpjfjktrfg2i3hsxsjm] => Array ( [status] => passed ) ) ) [commits:DifferentialRevision:private] => <attachable> [activeDiff:DifferentialRevision:private] => DifferentialDiff Object ( [revisionID:protected] => 494 [authorPHID:protected] => PHID-USER-pzgnjqvehwzwo6lmf56l [repositoryPHID:protected] => PHID-REPO-e2gijwty5qkn653ecnc2 [commitPHID:protected] => [sourceMachine:protected] => prod-mbp [sourcePath:protected] => /mnt/UserData/home/alex/web/d/in-portal.52x/ [sourceControlSystem:protected] => svn [sourceControlBaseRevision:protected] => svn://alex@source.in-portal.org/in-portal/branches/5.2.x@16818 [sourceControlPath:protected] => svn://alex@source.in-portal.org/in-portal/branches/5.2.x [lintStatus:protected] => 1 [unitStatus:protected] => 0 [lineCount:protected] => 522 [branch:protected] => /in-portal/branches/5.2.x [bookmark:protected] => [creationMethod:protected] => arc [repositoryUUID:protected] => 2d19b2cd-e369-0410-8045-b8fb98e743af [description:protected] => Same diff, but file moves in "modules/custom" folder are displayed correctly. [viewPolicy:protected] => public [unsavedChangesets:DifferentialDiff:private] => Array ( ) [changesets:DifferentialDiff:private] => <attachable> [revision:DifferentialDiff:private] => <attachable> [properties:DifferentialDiff:private] => Array ( ) [buildable:DifferentialDiff:private] => <attachable> [unitMessages:DifferentialDiff:private] => <attachable> [forcedNamespace:PhabricatorLiskDAO:private] => [ephemeral:LiskDAO:private] => [forcedConnection:LiskDAO:private] => [id:protected] => 1278 [phid:protected] => PHID-DIFF-5c5ups4fbwxokuzoykmd [dateCreated:protected] => 1731163901 [dateModified:protected] => 1731163907 ) [diffIDs:DifferentialRevision:private] => Array ( [0] => 1278 [1] => 1277 [2] => 1276 [3] => 1275 ) [hashes:DifferentialRevision:private] => <attachable> [repository:DifferentialRevision:private] => PhabricatorRepository Object ( [name:protected] => In-Portal [callsign:protected] => INP [repositorySlug:protected] => [uuid:protected] => 2d19b2cd-e369-0410-8045-b8fb98e743af [viewPolicy:protected] => public [editPolicy:protected] => admin [pushPolicy:protected] => users [profileImagePHID:protected] => [versionControlSystem:protected] => svn [details:protected] => Array ( [importing] => [local-path] => /var/repo/INP/ [remote-uri] => svn://source.in-portal.org/ [svn-subpath] => in-portal/ [tracking-enabled] => 1 [description] => [svn-layout] => custom [svn-trunk-folder] => [svn-branches-folder] => [svn-tags-folder] => releases [default-branch] => branches/5.2.x [hosting-enabled] => ) [credentialPHID:protected] => PHID-CDTL-erjfwrezuiji6v2u5t2h [almanacServicePHID:protected] => [spacePHID:protected] => [localPath:protected] => /var/repo/INP/ [commitCount:PhabricatorRepository:private] => <attachable> [mostRecentCommit:PhabricatorRepository:private] => <attachable> [projectPHIDs:PhabricatorRepository:private] => <attachable> [uris:PhabricatorRepository:private] => <attachable> [profileImageFile:PhabricatorRepository:private] => <attachable> [forcedNamespace:PhabricatorLiskDAO:private] => [ephemeral:LiskDAO:private] => [forcedConnection:LiskDAO:private] => [id:protected] => 1 [phid:protected] => PHID-REPO-e2gijwty5qkn653ecnc2 [dateCreated:protected] => 1395334942 [dateModified:protected] => 1725347404 ) [reviewerStatus:DifferentialRevision:private] => Array ( [PHID-USER-ipoqh66gzfk7qrkmex54] => DifferentialReviewer Object ( [revisionPHID:protected] => PHID-DREV-nwdfrwmuglsmlax4j32j [reviewerPHID:protected] => PHID-USER-ipoqh66gzfk7qrkmex54 [reviewerStatus:protected] => added [lastActionDiffPHID:protected] => [lastCommentDiffPHID:protected] => PHID-DIFF-5c5ups4fbwxokuzoykmd [lastActorPHID:protected] => [voidedPHID:protected] => [options:protected] => Array ( ) [authority:DifferentialReviewer:private] => Array ( ) [changesets:DifferentialReviewer:private] => <attachable> [forcedNamespace:PhabricatorLiskDAO:private] => [ephemeral:LiskDAO:private] => [forcedConnection:LiskDAO:private] => [id:protected] => 506 [phid:protected] => [dateCreated:protected] => 1731093116 [dateModified:protected] => 1731093116 ) ) [customFields:DifferentialRevision:private] => <attachable> [drafts:DifferentialRevision:private] => Array ( [u.public] => ) [flags:DifferentialRevision:private] => Array ( [] => ) [forceMap:DifferentialRevision:private] => Array ( ) [forcedNamespace:PhabricatorLiskDAO:private] => [ephemeral:LiskDAO:private] => [forcedConnection:LiskDAO:private] => [id:protected] => 494 [phid:protected] => PHID-DREV-nwdfrwmuglsmlax4j32j [dateCreated:protected] => 1731093114 [dateModified:protected] => 1731514560 ) )
⚙ D469 INP-1861 - Cache results of the PHP_CodeSniffer & PHP_MessDetector
Page MenuHomeIn-Portal Phabricator

INP-1861 - Cache results of the PHP_CodeSniffer & PHP_MessDetector
ClosedPublic

Authored by alex on May 30 2024, 7:32 AM.

Details

Test Plan

The PHP Mess Detector (all modules)

In CLI:

  1. delete the build/cache/pmd_modules_result_cache.php and build/cache/pmd_core_result_cache.php files
  2. run the phing -f tools/build/build_all.xml phpmd-ci command
  3. remember previous command execution time (shown after Total time: ...)
  4. open any of above deleted cache files for editing
  5. confirm, that it contains relative paths to project files
  6. re-run the same command
  7. remember previous command execution time (shown after Total time: ...)
  8. confirm, that 2nd run of the command went much faster, then the 1st one

The PHP Mess Detector (custom module)

In CLI:

  1. delete the pmd_custom_result_cache.php file
  2. run the phing -f tools/build/build_custom.xml phpmd-ci command
  3. remember previous command execution time (shown after Total time: ...)
  4. open above deleted cache file for editing
  5. confirm, that it contains relative paths to project files
  6. re-run the same command
  7. remember previous command execution time (shown after Total time: ...)
  8. confirm, that 2nd run of the command went faster, then the 1st one

The PHP Code Sniffer (all modules)

In CLI:

  1. run the phing -f tools/build/build_all.xml phpcs-ci command
  2. remember previous command execution time (shown after Time: ...)
  3. re-run the same command
  4. remember previous command execution time (shown after Time: ...)
  5. confirm, that 2nd run of the command went much faster, then the 1st one

The PHP Code Sniffer (custom module)

In CLI:

  1. run the phing -f tools/build/build_custom.xml phpcs-ci command
  2. remember previous command execution time (shown after Time: ...)
  3. re-run the same command
  4. remember previous command execution time (shown after Time: ...)
  5. confirm, that 2nd run of the command went faster, then the 1st one

Diff Detail

Repository
rINP In-Portal
Branch
/in-portal/branches/5.2.x
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 1249
Build 1249: arc lint + arc unit

Event Timeline

alex created this revision.May 30 2024, 7:32 AM
alex requested review of this revision.May 30 2024, 7:32 AM
alex added a project: Restricted Project.May 30 2024, 7:32 AM
erik requested changes to this revision.May 30 2024, 11:33 AM

Time reports for all 8 tests

Total time: 9 minutes 51.26 seconds
Total time: 6 minutes 19.33 seconds

Total time: 1.8955 second
Total time: 2.0889 seconds

Total time: 3 minutes 32.83 seconds
Total time: 14.3168 seconds

Total time: 1.9503 second
Total time: 2.0391 seconds

So 1st and 3rd command are ok.
But 2nd and 4rd commands on second run were slower than on 1st run.

This revision now requires changes to proceed.May 30 2024, 11:33 AM
erik accepted this revision.May 31 2024, 5:34 AM
This revision is now accepted and ready to land.May 31 2024, 5:34 AM
alex updated this revision to Diff 1204.May 31 2024, 5:38 AM

Bugfix: the PHP_MessDetector was building it's cache with absolute paths instead of a relative ones.

alex updated this revision to Diff 1205.May 31 2024, 5:47 AM

Removed debug code.

alex edited the test plan for this revision. (Show Details)May 31 2024, 6:02 AM
alex updated this revision to Diff 1206.May 31 2024, 6:57 AM

Indicate PHP_CodeSniffer & PHP_MessDetector versions, that support caching.

erik accepted this revision.May 31 2024, 7:13 AM

all right, test times:

Total time: 7 minutes 34.23 seconds
Total time: 2.1493 seconds

Total time: 1.7272 second
Total time: 0.8593 seconds

Total time: 6 minutes 49.16 seconds
Total time: 27.9625 seconds

Total time: 3.5159 seconds
Total time: 3.1935 seconds

This revision was automatically updated to reflect the committed changes.