Skip to content

Test cleanup #137

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

Merged
merged 7 commits into from
Aug 26, 2016
Merged

Test cleanup #137

merged 7 commits into from
Aug 26, 2016

Conversation

Nyholm
Copy link
Contributor

@Nyholm Nyholm commented Aug 6, 2016

This is a PR containing a few minor things:

  • Let you be able to run phpunit command in root by adding in phpunit.xml
  • Renamed phpunit.xml to phpunit.xml.dist because phpunit.xml is reserved for developer specific config (it will override phpunit.xml.dist)
  • Moved post-install-cmd to a separate file (and made sure it works)
  • Removed the boostrap file for tests. We should use composer's autoload directly
  • Removed the ClassUtils because it had some bugs. Only some were fixed in Remove dependency form Guzzle #131.
  • Moved tests to "autoload-dev" in composer.

The ClassUtils class made me think that the same functionality should be reused in other packages. I created a package and made sure to add tests and some more features (like supporting inheritance). The API is also a bit cleaner than the old ClassUtils

@Nyholm Nyholm force-pushed the tests branch 3 times, most recently from 1f83434 to 3986988 Compare August 10, 2016 12:38
@Nyholm
Copy link
Contributor Author

Nyholm commented Aug 10, 2016

I did also remove composer.lock since it had trouble installing PHPUnit on different php versions (We want to support more versions than phpunit 5.x does.)

This PR is ready for review

@Nyholm
Copy link
Contributor Author

Nyholm commented Aug 12, 2016

Ping @avrahamgoldman

@avigoldman
Copy link
Contributor

Hey @Nyholm! Sorry for the delayed response here. I'm going to review this PR this upcoming Monday 👍

@Nyholm
Copy link
Contributor Author

Nyholm commented Aug 12, 2016

Thank you!

@Nyholm
Copy link
Contributor Author

Nyholm commented Aug 19, 2016

Any updates?

@Nyholm
Copy link
Contributor Author

Nyholm commented Aug 25, 2016

Could I help you to review this in any way?

test.php
composer.lock

Choose a reason for hiding this comment

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

let's keep composer.lock in version control

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed composer lock because it caused issues with phpunit and different Php versions. See https://travis-ci.org/SparkPost/php-sparkpost/builds/151201635

Choose a reason for hiding this comment

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

gotcha... It looks like it's just failing for 5.5. We follow the PHP supported versions (http://php.net/supported-versions.php) and 5.5 is EOL. Let's just drop the 5.5 req from travis.yml, that should mean we can keep the lock file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool. I very much agree with dropping 5.5 =)

@colestrode
Copy link

colestrode commented Aug 25, 2016

Hey Nyholm, thanks for the PR :) I'm going to start looking at this today.

Would you mind sharing what bugs you found in ClassUtils that NSA fixes?

@@ -3,7 +3,7 @@
xsi:noNamespaceSchemaLocation='http://schema.phpunit.de/4.5/phpunit.xsd'
backupGlobals='true'
backupStaticAttributes='false'
bootstrap='test/unit/bootstrap.php'
bootstrap='./vendor/autoload.php'

Choose a reason for hiding this comment

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

nice, this is much cleaner

@Nyholm
Copy link
Contributor Author

Nyholm commented Aug 25, 2016

Thank you for taking time to review this.

Except for the bug fixes I found and fixed in #131, there were the following issues with ClassUtils:

  • You could not get a property of a parent class
  • It was not stateless, ie you needed a new instance of ClassUtils for each class you wanted to use it for
  • No support for static methods or properties
  • You could not give a method any arguments
  • No argument validation
  • You got strange exceptions if you tried to get a non-existent property or method.

@colestrode
Copy link

awesome, thanks for the run down. I'm taking off for the day but will come back to this in the morning.

@Nyholm
Copy link
Contributor Author

Nyholm commented Aug 25, 2016

Thank you!

"php-http/guzzle6-adapter": "^1.0",
"mockery/mockery": "^0.9.4",
"fabpot/php-cs-fixer": "^1.11"
"friendsofphp/php-cs-fixer": "^1.11",

Choose a reason for hiding this comment

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

this is the same lib, right? just moved under a different org?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is correct.

@colestrode
Copy link

I'm just going to make sure I can run all the tests locally, but this is looking great so far 👍

@colestrode
Copy link

Worked like a charm! Great PR @Nyholm :) I'll merge this in now.

Btw, if you can't get enough of PHP+Sparkpost, feel free to join us in our community Slack at slack.sparkpost.com :)

@colestrode colestrode merged commit 8c75ab0 into SparkPost:master Aug 26, 2016
@Nyholm
Copy link
Contributor Author

Nyholm commented Aug 26, 2016

Awesome. Thank you for merging!

@Nyholm Nyholm deleted the tests branch August 26, 2016 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants