-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Update CONTRIBUTING.md #373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The PHPUnit tests run into error messages if PHPWord has not been installed by Composer.
Sounds reasonable. Thanks for the PR. |
By the way, I'm stuck a bit. @franzholz, could you please clarify your sentence? Do you want just explicitly indicate that someone must have PHPWord sources (at all) to run unit tests? Or you meant that PHPWord sources retrieved in any way except Composer won't allow to run unit tests? |
It is the second. If you have PHPWord PHP code on your computer, and if you did formerly not use Composer to install it, then you cannot run the PHPUnit test. This has cost me several hours to figure this out. The PHPWord sources are not sufficient to run the tests. |
Hi, @franzholz. I've just tried to run unit tests against PHPWord source code, downloaded from GitHub repo without Composer. You know, I succeeded. Could you please describe how did you try (step by step)? |
I have added the same in issue #372. I have fetched the whole PHPWord from Git and put it under my local folder PHPWordDevelop.
Then I start the unit tests. And they hang in an error message.
I also tried to start the tests from inside of the folder PHPWordDevelop. And the tests still hang.
So I think that it is necessary to fetch the PHP code using Composer. |
Great! This is the expected behavior, because PHPUnit really doesn't know where to get the classes. Please try calling PHPUnit with Information about PHPUnit comman-line options can be found here. |
So I must start the tests from outside of the folder PHPWordDevelop.
|
Do you have |
I do not have a vendor folder inside of PHPWordDevelop. The vendor folder is on the same level as PHPWordDevelop. The base directory is /var/www/html/developer. The base directory contains the folders PHPWordDevelop and vendor. The vendor folder contains an autoload. However this has been generated by Composer. Everything inside of the vendor folder has been installed by Composer. |
Can you run these commands inside PHPWordDevelop: cd PHPWordDevelop
curl -sS https://getcomposer.org/installer | php
php composer.phar install --dev
php vendor/bin/phpunit --bootstrap=tests/bootstrap.php should run the tests fine |
So I did install all this bunch of software packages inside of PHPWordDevelop. This has the big drawback that I need reinstall them only for PHPWord.
So I try to use phpunit directly:
So I read the files inside of my second vendor folder:
|
You need to use the version of PHPUnit provided by PHPWord, make sure you are inside the PHPWord directory when executing the following command (sorry I made a typo in my previous comment and that is why it did not work): php vendor/bin/phpunit --bootstrap=tests/bootstrap.php
You only need to install dev dependencies when developing the PHPWord library, no need to include them if you just want to include PHPWord inside of a project. If you are planning on contributing you should indeed clone PHPWord independently, install all required development dependencies, and run tests cases as intended. |
This now runs the tests.
Maybe you should add this to the documentation. I would still prefer to have only one vendor folder which is on the same level as the PHPWordDevelop folder. Then I can easily install third party packages as dompdf. |
This is the intended behaviour for both the dompdf and phpword libraries. You should install them separately and work on them separately. Then, when you are done working on them, you should include them in your main project. You should not work on these two libraries from inside the vendor directory. |
The PHPUnit tests run into error messages if PHPWord has not been installed by Composer.