Skip to content

Commit

Permalink
Merge a0a0690 into 0e605c2
Browse files Browse the repository at this point in the history
  • Loading branch information
jails committed Sep 24, 2016
2 parents 0e605c2 + a0a0690 commit 72f543e
Show file tree
Hide file tree
Showing 233 changed files with 11,904 additions and 10,915 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,3 +4,4 @@ composer.phar
vendor
codeclimate.json
coveralls.json
clover.xml
23 changes: 15 additions & 8 deletions .travis.yml
@@ -1,30 +1,37 @@
sudo: false
sudo: required
dist: xenial
group: edge
language: php

php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm

matrix:
fast_finish: true
allow_failures:
- php: hhvm

before_script:
- composer config -g github-oauth.github.com $GITHUB_COMPOSER_AUTH
- composer self-update
- composer install --no-interaction
- if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then echo 'xdebug.enable = On' >> /etc/hhvm/php.ini; fi
#- if [[ $TRAVIS_PHP_VERSION =~ ^7 ]]; then pecl install xdebug; fi
- if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then echo 'hhvm.php7.all = 1' >> /etc/hhvm/php.ini; fi
- if [[ $TRAVIS_PHP_VERSION =~ ^7 ]]; then pecl install xdebug; fi

script: bin/kahlan --config=kahlan-config.travis.php --clover=clover.xml
script:
- vendor/bin/phpcs
- bin/kahlan --config=kahlan-config.travis.php --clover=clover.xml

after_success:
- "if [ $(phpenv version-name) = '5.6' ]; then curl -X POST -d @codeclimate.json -H 'Content-Type:application/json' https://codeclimate.com/test_reports --verbose; fi"
- "if [ $(phpenv version-name) = '5.6' ]; then curl -F 'json_file=@coveralls.json' https://coveralls.io/api/v1/jobs --verbose; fi"
- "if [ $(phpenv version-name) = '5.6' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi"
- "if [ $(phpenv version-name) = '5.6' ]; then php ocular.phar code-coverage:upload --format=php-clover 'clover.xml'; fi"
- "if [ $(phpenv version-name) = '7.0' ]; then curl -X POST -d @codeclimate.json -H 'Content-Type:application/json' https://codeclimate.com/test_reports --verbose; fi"
- "if [ $(phpenv version-name) = '7.0' ]; then curl -F 'json_file=@coveralls.json' https://coveralls.io/api/v1/jobs --verbose; fi"
- "if [ $(phpenv version-name) = '7.0' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi"
- "if [ $(phpenv version-name) = '7.0' ]; then php ocular.phar code-coverage:upload --format=php-clover 'clover.xml'; fi"

env:
global:
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,22 @@

## Last changes

## 3.0.0 (2016-09-01)

* **Add:** Add `allow()` DSL.
* **Add:** Add `toBeCalled()` matcher.
* **Add:** `toReceive` now support a chain of messages as definition if correctly stubbed.
* **Add:** Allow to monkey patch a class using a specific instance for all `new` on that class.
* **Change:** Refactor the reporting to provide more meaningful messages on failure.
* **Bugfix:** Fixes an issue with `toReceive()/toBeCalled` and stubs where past called methods were taken into account.
* **BC break:** Cached files are no more compatible, cached files needs to be purged.
* **BC break:** Rename `'params'` option to `'args'` in `Double::instance()`.
* **BC break:** `Stub::on()` is now deprecated use `allow()` instead.
* **BC break:** Rename `Stub::create()` to `Double::instance()`.
* **BC break:** Rename `Stub::classname()` to `Double::classname()`.
* **BC break:** Rename `before()` and `after()` to `beforeAll()` and `afterAll()`.
* **BC break:** Remove `toReceiveNext` matchers in flavor of `->ordered` attribute to be more close to rspec way.

## 2.5.7 (2016-09-23)

* **BC break:** Moving Kahlan to its own organization.
Expand Down
45 changes: 32 additions & 13 deletions README.md
Expand Up @@ -11,13 +11,12 @@

Kahlan is a full-featured Unit & BDD test framework a la RSpec/JSpec which uses a `describe-it` syntax and moves testing in PHP one step forward.

Kahlan embraces the [KISS principle](http://en.wikipedia.org/wiki/KISS_principle) and makes Unit & BDD testing fun again!
**Kahlan allows to stub or monkey patch your code directly like in Ruby or JavaScript without any required PECL-extentions.**

**Killer feature:** Kahlan allows to stub or monkey patch your code directly like in Ruby or JavaScript without any required PECL-extentions.

## Video
## Videos

* <a href="http://vimeo.com/116949820" target="_blank">Warren Seymour presentation at Unified Diff (2015)</a>
* <a href="https://www.grafikart.fr/tutoriels/php/tdd-kahlan-805" target="_blank">Grafikart presentation in French (2016)</a>

## IRC

Expand All @@ -26,42 +25,62 @@ Kahlan embraces the [KISS principle](http://en.wikipedia.org/wiki/KISS_principle

## Documentation

See the whole [documentation here](http://kahlan.readthedocs.org/en/latest) (documentation for Kahlan <= 1.3.0 [can still be found here](docs/deprecated))
See the whole [documentation here](https://kahlan.github.io/docs)

## Requirements

* PHP 5.5+
* Composer
* [Xdebug](http://xdebug.org/) (if you want to perform code coverage analysis)
* [phpdbg](http://php.net/manual/en/debugger-about.php) or [Xdebug](http://xdebug.org/) (required for code coverage analysis only)

## Main Features

* Simple API
* RSpec/JSpec syntax
* Code Coverage metrics ([xdebug](http://xdebug.org) or [phpdbg](http://phpdbg.com/docs) required)
* Handy stubbing system ([mockery](https://github.com/padraic/mockery) or [prophecy](https://github.com/phpspec/prophecy) are no longer needed)
* Set stubs on your class methods directly (i.e allows dynamic mocking)
* Ability to Monkey Patch your code (i.e. allows replacement of core functions/classes on the fly)
* Check called methods on your class/instances
* Check called methods on your classes/instances
* Built-in Reporters (Terminal or HTML reporting through [istanbul](https://gotwarlost.github.io/istanbul/) or [lcov](http://ltp.sourceforge.net/coverage/lcov.php))
* Built-in Exporters (Coveralls, Code Climate, Scrutinizer, Clover)
* Extensible, customizable workflow
* Small code base (~10 times smaller than PHPUnit)

## Syntax

```php
<?php

describe("Example", function() {

it("passes if true === true", function() {
it("makes an expectation", function() {

expect(true)->toBe(true);

});

it("expects methods to be called", function() {

expect($user)->toReceive('save')->with(['validates' => false]);

$user = new User();
$user->validates(['validates' => false]);

});

it("stubs a function", function() {

expect(true)->toBe(true);
allow('time')->toBeCalled()->andReturn(123);
$user = new User();
expect($user->save())->toBe(true)
expect($user->created)->toBe(123);

});

it("passes if false !== true", function() {
it("stubs a class", function() {

expect(false)->not->toBe(true);
allow('PDO')->toReceive('prepare', 'fetchAll')->andReturn([['name' => 'bob']]);
$user = new User();
expect($user->all())->toBe([['name' => 'bob']]);

});

Expand Down
8 changes: 7 additions & 1 deletion composer.json
Expand Up @@ -11,11 +11,17 @@
"require": {
"php": ">=5.4"
},
"require-dev": {
"squizlabs/php_codesniffer": "^2.7"
},
"autoload": {
"psr-4": {
"Kahlan\\": "src/"
},
"files": ["src/init.php"]
"files": [
"src/init.php",
"src/functions.php"
]
},
"autoload-dev": {
"psr-4": {
Expand Down
44 changes: 0 additions & 44 deletions docs/README.md

This file was deleted.

Binary file removed docs/assets/phpunit_4.4_code_coverage.png
Binary file not shown.
102 changes: 0 additions & 102 deletions docs/config-file.md

This file was deleted.

44 changes: 0 additions & 44 deletions docs/deprecated/README.md

This file was deleted.

Binary file removed docs/deprecated/assets/code_coverage.png
Binary file not shown.
Binary file removed docs/deprecated/assets/custom_reporter.png
Binary file not shown.
Binary file removed docs/deprecated/assets/dot_reporter.png
Binary file not shown.
Binary file removed docs/deprecated/assets/phpunit_4.4_code_coverage.png
Binary file not shown.
Binary file removed docs/deprecated/assets/verbose_reporter.png
Binary file not shown.
Binary file removed docs/deprecated/assets/warning.png
Binary file not shown.

0 comments on commit 72f543e

Please sign in to comment.