How To Execute Unit Tests For Octobercms/library

- 1 answer

What is the proper way of executing unit tests for octobercms/library?

I could successfully execute unit tests with the following condition.

  • Use the copy installed in my OctoberCMS project in vendor directory.
  • Modify bootstrap path in october/rain/tests/phpunit.xml to bootstrap="../../../../vendor/autoload.php"
  • Execute ../../../../vendor/bin/phpunit from october/rain/tests.

But, I feel like there is a better way. I wonder how other committer is executing tests.



First of all thanks for showing interest in contributing to October CMS,

I would say you don't need to modify a single line.

first let's be specific and we only need to test octobercms/library as we don't need to make things complex

let's assume you have working local October CMS based website on your machine.

  1. now go to vendor\october\rain folder as october lib resides there. (inside termial)

  2. now do composer install there

if you find any dependency issue in installation.(Then ONLY follow this), I found some problem here some dependency issue so, i need to remove this 2 dependencies from composer.json

if you find same issue then : go to "require-dev" section -> remove

1."illuminate/routing": "5.5.*"

2."swiftmailer/swiftmailer": "~5.1"

3. now try to install composer install again.

  1. when its done.

  2. just got vendor\october\rain\tests directory (inside termial)

  3. execute command for windows .\..\vendor\bin\phpunit.batand for linux/mac ./../vendor/bin/phpunit

  4. it will automatically detect all the stuff and execute tests for you.

if you face any issue please add comment.