1

I've made a little composer package. My composer.json file as simple as it could be, it only contains name, description, author and something like that.

No require or require-dev object is provided.

I'm using PSR-4 autoloading system, and I have a directory structure like this:

|-author/package
|-- src/
|----MyClass.php
|-- tests/
|-- readme.md

And now I want to add unit testing for this package. I've created tests/ directory, but at this moment it's empty.

Can you tell me what should I do next to add unit testing for the package?

I've been searching for a while now on Google, and couldn't find any related answers.

P.S, it's a Laravel specific package.

1 Answer 1

2

Adding PHPUnit in a decent version looks like the first step to do:

composer require --dev phpunit/phpunit:~4.5

This will place the phpunit executable in vendor/bin/phpunit. You can run it from there.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks @Sven, after not getting answer here for a while, I thought that this is how it's done. In my case, I also needed to "require" the package from illuminate to make it work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.