Skip to content

Commit

Permalink
Merge pull request #21 from clue-labs/phpunit
Browse files Browse the repository at this point in the history
Add PHPUnit to require-dev
  • Loading branch information
clue authored Jun 29, 2017
2 parents fba4e31 + a4ec330 commit 6b1779d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ install:
- composer install --no-interaction

script:
- phpunit --coverage-text
- vendor/bin/phpunit --coverage-text
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ to execute individual functions depending on the arguments given.
* [Route](#route)
* [NoRouteFoundException](#noroutefoundexception)
* [Install](#install)
* [Tests](#tests)
* [License](#license)
* [More](#more)

Expand Down Expand Up @@ -554,6 +555,21 @@ $ composer require clue/commander:^1.2

See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.

## Tests

To run the test suite, you first need to clone this repo and then install all
dependencies [through Composer](http://getcomposer.org):

```bash
$ composer install
```

To run the test suite, go to the project root and run:

```bash
$ php vendor/bin/phpunit
```

## License

MIT
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"php": ">=5.3"
},
"require-dev": {
"clue/arguments": "^1.0"
"clue/arguments": "^1.0",
"phpunit/phpunit": "^5.0 || ^4.8"
}
}
2 changes: 1 addition & 1 deletion tests/RouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class RouteTest extends PHPUnit_Framework_TestCase
{
public function testToStringWillReturnStringFromToken()
{
$token = $this->getMock('Clue\Commander\Tokens\TokenInterface');
$token = $this->getMockBuilder('Clue\Commander\Tokens\TokenInterface')->getMock();
$token->expects($this->once())->method('__toString')->willReturn('test');

$route = new Route($token, 'var_dump');
Expand Down
6 changes: 3 additions & 3 deletions tests/Tokens/AlternativeTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class AlternativeTokenTest extends PHPUnit_Framework_TestCase
public function testSupportsAnyTwoTokens()
{
new AlternativeToken(array(
$this->getMock('Clue\Commander\Tokens\TokenInterface'),
$this->getMock('Clue\Commander\Tokens\TokenInterface'),
$this->getMockBuilder('Clue\Commander\Tokens\TokenInterface')->getMock(),
$this->getMockBuilder('Clue\Commander\Tokens\TokenInterface')->getMock(),
));
}

Expand All @@ -35,7 +35,7 @@ public function testRequiresValidTokens()

public function testDoesNotSupportOptional()
{
$token = $this->getMock('Clue\Commander\Tokens\TokenInterface');
$token = $this->getMockBuilder('Clue\Commander\Tokens\TokenInterface')->getMock();
$tokens = array(
$token,
new OptionalToken($token)
Expand Down
4 changes: 2 additions & 2 deletions tests/Tokens/SentenceTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class SentenceTokenTest extends PHPUnit_Framework_TestCase
public function testSupportsAnyTwoTokens()
{
new SentenceToken(array(
$this->getMock('Clue\Commander\Tokens\TokenInterface'),
$this->getMock('Clue\Commander\Tokens\TokenInterface'),
$this->getMockBuilder('Clue\Commander\Tokens\TokenInterface')->getMock(),
$this->getMockBuilder('Clue\Commander\Tokens\TokenInterface')->getMock(),
));
}

Expand Down

0 comments on commit 6b1779d

Please sign in to comment.