Skip to content

Commit

Permalink
Merge pull request #207 from elliotchance/release/1.4
Browse files Browse the repository at this point in the history
Release/1.4
  • Loading branch information
elliotchance committed Oct 7, 2014
2 parents a781f81 + 18b198d commit 98e3d33
Show file tree
Hide file tree
Showing 99 changed files with 4,572 additions and 419 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
@@ -1,3 +1,3 @@
[submodule "wiki"]
path = wiki
url = https://github.com/elliotchance/concise.wiki.git
url = https://elliotchance@github.com/elliotchance/concise.wiki.git
5 changes: 5 additions & 0 deletions .travis.yml
@@ -1,12 +1,17 @@
language: php
php:
- 5.3.3
- 5.3
- 5.4
- 5.5
matrix:
include:
- php: 5.6
env: PHPUNIT_OPTIONS="--coverage-clover build/logs/clover.xml"
- php: 5.6
env: COMPOSER=composer41.json
- php: 5.6
env: COMPOSER=composer40.json

install:
- composer install
Expand Down
48 changes: 28 additions & 20 deletions README.md
Expand Up @@ -15,24 +15,26 @@ Simple Example
```php
class AttributeTest extends TestCase
{
public function testEquality()
{
// the entire assertion can be string
$this->assert('123 equals "123"');

// it will understand when you mean an attribute
$this->foo = 'bar';
$this->assert('foo is the same as "bar"');

// or you can create your assertion by chaining
$this->assert($result, exactly_equals, 123);
}

// the assertion can be taken directly from the method name
public function test_adding3and5_equals_8()
{
$this->adding3and5 = $this->calc->add(3, 5);
}
public function testAssertionsCanBeBuiltWithChaining()
{
$result = 100 + 23;
$this->assert($result, exactly_equals, 123);

$a = ['foo' => 'bar'];
$this->assert($a, is_an_associative_array);
$this->assert($a, has_key, 'foo', with_value, 'bar');
}

public function testAssertionsAreJustStrings()
{
$this->assert('123 equals "123"');
}

public function testAttributesAreNativelyUnderstood()
{
$this->foo = 'bar';
$this->assert('foo is the same as "bar"');
}
}
```

Expand All @@ -46,7 +48,7 @@ $calculator = $this->mock('\My\Calculator')
->expect('add')->with(3, 5)->andReturn(8)
->stub('clear')->andThrow(new \CantClearException())
->expect('subtract')->never()
->done();
->get();
```

Mocks will throw an exception for any method that is called that isn't told what to do. So maybe you need a
Expand All @@ -56,7 +58,7 @@ methods:
```php
$calculator = $this->niceMock('\My\Calculator')
->stub(['add' => 8]) // always return 8 for add()
->done();
->get();
```

You can read more on the [Mocking](https://github.com/elliotchance/concise/wiki/Mocking) wiki page.
Expand Down Expand Up @@ -114,8 +116,14 @@ Matchers
### Booleans

* `false` - Always fail.
* `? is a boolean` - Assert a value is true or false.
* `? is a bool`
* `? is false` - Assert value is false.
* `? is falsy` - Assert a value is a false-like value.
* `? is not a boolean` - Assert a value is not true or false.
* `? is not a bool`
* `? is true` - Assert a value is true.
* `? is truthy` - Assert a value is a non false-like value.
* `true` - Always pass.

### Exceptions
Expand Down
28 changes: 28 additions & 0 deletions composer40.json
@@ -0,0 +1,28 @@
{
"name": "elliotchance/concise",
"type": "library",
"description": "Concise is test framework for using plain English and minimal code, built on PHPUnit.",
"keywords": ["unit testing", "unit", "test", "phpunit", "tdd", "mocking", "mock", "assert", "assertion"],
"homepage": "https://github.com/elliotchance/concise",
"license": "MIT",
"authors": [
{
"name": "Elliot Chance",
"email": "elliotchance@gmail.com"
}
],
"bin": ["bin/concise"],
"require": {
"php": ">=5.3.0",
"kevinlebrun/colors.php": ">= 0.3.0"
},
"require-dev": {
"phpunit/phpunit": "4.0.*",
"satooshi/php-coveralls": "dev-master"
},
"autoload": {
"psr-0": {
"": [ "tests/", "src/" ]
}
}
}

0 comments on commit 98e3d33

Please sign in to comment.