Skip to content
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

Port atoum tests to PHPUnit #300

Merged
merged 12 commits into from
Jun 4, 2020
Merged

Port atoum tests to PHPUnit #300

merged 12 commits into from
Jun 4, 2020

Conversation

k00ni
Copy link
Collaborator

@k00ni k00ni commented Jun 1, 2020

This pull request replaces atoum tests with PHPUnit tests.

We have code coverage now (via scrutinizer):

Reasons for this pull request

  • use PHPUnit, because it more known and better integrated as atoum
  • enable code coverage analysis
  • aligned and fixed some tests (e.g. removed code which was commented out)

Changes

  • test related files are located in test/
  • tests itself are located in tests/
  • replaced many atoum tests with PHPUnit ones
  • put tests and test related files into a separate namespace (using PSR-4)
  • remove usages of full class paths, used use Class instead
  • use functions to get class-instances during tests, like for Parser. That makes tests more decoupled from the actual class constructor and in case it changes, only 1 place has to be adapted.

TODOs:

@k00ni k00ni requested a review from j0k3r June 1, 2020 15:51
@k00ni k00ni changed the title Replace atoum with PHPUnit Port atoum tests PHPUnit Jun 1, 2020
@k00ni k00ni changed the title Port atoum tests PHPUnit Port atoum tests to PHPUnit Jun 2, 2020
@k00ni k00ni marked this pull request as ready for review June 2, 2020 10:13
@k00ni k00ni requested a review from smalot June 2, 2020 10:13
Copy link
Collaborator

@j0k3r j0k3r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!
I won't review all the changes from Atoum to PHPUnit, to much stuff to check.
I trust you.

You should add the scrutinizer badge to the README.

src/Smalot/PdfParser/Page.php Show resolved Hide resolved
phpunit.xml Outdated Show resolved Hide resolved
composer.json Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
@j0k3r
Copy link
Collaborator

j0k3r commented Jun 2, 2020

I'm wondering why does Scrutinizer doesn't show up along with Travis build 🤔

@k00ni
Copy link
Collaborator Author

k00ni commented Jun 2, 2020

I'm wondering why does Scrutinizer doesn't show up along with Travis build

I don't know. But in case you are interested in the latest results: https://scrutinizer-ci.com/g/smalot/pdfparser/?branch=feature/switch-to-phpunit

.travis.yml Outdated Show resolved Hide resolved
phpunit.xml Outdated Show resolved Hide resolved
@k00ni
Copy link
Collaborator Author

k00ni commented Jun 3, 2020

I am still not sure when it runs code coverage. Even if you have logging in the phpunit.xml it wont create coverage. You always had to use the --coverage-* option when calling PHPUnit. At least when i run it locally (vendor/bin/phpunit).

@j0k3r
Copy link
Collaborator

j0k3r commented Jun 3, 2020

With logging in the phpunit.xml, the test suite is slower and it generates the coverage.

Without logging:
image

With logging:
image

You can see it generates the coverage.

@k00ni
Copy link
Collaborator Author

k00ni commented Jun 3, 2020

Good catch! I just saw, that i used a Docker container without xdebug installed.

OK anything left or can i merge it?

@j0k3r
Copy link
Collaborator

j0k3r commented Jun 3, 2020

Looks great, you can squash your commits 👍

@k00ni k00ni merged commit 66ad271 into master Jun 4, 2020
@k00ni k00ni deleted the feature/switch-to-phpunit branch June 4, 2020 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants