This repository has been archived by the owner on Sep 20, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from vonglasow/tests
Add first test for Mark class.
- Loading branch information
Showing
4 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
language: php | ||
|
||
branches: | ||
only: | ||
- staging | ||
- trying | ||
- master | ||
|
||
matrix: | ||
include: | ||
- php: 5.5 | ||
- php: 5.6 | ||
- php: 7.0 | ||
- php: 7.1 | ||
env: | ||
- ENABLE_XDEBUG=true | ||
- php: 7.1 | ||
env: | ||
- ENABLE_DEVTOOLS=true | ||
- php: nightly | ||
allow_failures: | ||
- php: nightly | ||
fast_finish: true | ||
|
||
os: | ||
- linux | ||
|
||
notifications: | ||
irc: "chat.freenode.net#hoaproject" | ||
|
||
sudo: false | ||
|
||
env: | ||
global: | ||
- secure: "AAAAB3NzaC1yc2EAAAADAQABAAAAgQCP/MRQTkDEQdlnhiVbW5dl3dSPBI8KO0EkCLRJ8mEOJ6gm9VH0yy2IyiBuGa+Oyj+cbdKkASN4B/nMvPS+POG9Qd+z9aSmgYZd1ZwVbmu1r0ag53qhQAiodLudzBpjS3RA0MJyX3IJu7HdMNo8qhx0M9WF+vGkcOAYqbsifakO8Q==" | ||
|
||
cache: | ||
directories: | ||
- vendor/ | ||
|
||
before_script: | ||
- export PATH="$PATH:$HOME/.composer/vendor/bin" | ||
- if [[ ! $ENABLE_XDEBUG ]]; then | ||
phpenv config-rm xdebug.ini || echo "ext-xdebug is not available, cannot remove it."; | ||
fi | ||
|
||
script: | ||
- composer install | ||
- vendor/bin/hoa test:run | ||
- if [[ $ENABLE_DEVTOOLS ]]; then | ||
composer global require friendsofphp/php-cs-fixer; | ||
vendor/bin/hoa devtools:cs --diff --dry-run .; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
|
||
/** | ||
* Hoa | ||
* | ||
* | ||
* @license | ||
* | ||
* New BSD License | ||
* | ||
* Copyright © 2007-2017, Hoa community. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* * Neither the name of the Hoa nor the names of its contributors may be | ||
* used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
namespace Hoa\Bench\Test\Unit; | ||
|
||
use Hoa\Bench\Mark as CUT; | ||
use Hoa\Test; | ||
|
||
/** | ||
* Class \Hoa\Bench\Test\Unit\Mark. | ||
* | ||
* Test suite of the examples in the documentation. | ||
* | ||
* @copyright Copyright © 2007-2017 Hoa community | ||
* @license New BSD License | ||
*/ | ||
class Mark extends Test\Unit\Suite | ||
{ | ||
public function case_classical() | ||
{ | ||
$this | ||
->object( | ||
$mark = new CUT($id = uniqid()) | ||
)->string($mark->getId())->isEqualTo($id) | ||
->boolean($mark->isRunning())->isFalse() | ||
->boolean($mark->isPause())->isFalse() | ||
->assert('Start mark') | ||
->when($SUT = $mark->start()) | ||
->object($SUT)->isInstanceOf('Hoa\Bench\Mark') | ||
->boolean($mark->isRunning())->isTrue() | ||
->boolean($mark->isPause())->isFalse() | ||
->assert('Pause mark') | ||
->when($SUT = $mark->pause()) | ||
->object($SUT)->isInstanceOf('Hoa\Bench\Mark') | ||
->boolean($mark->isRunning())->isTrue() | ||
->boolean($mark->isPause())->isTrue() | ||
->assert('Restart mark after pause') | ||
->when($SUT = $mark->start()) | ||
->object($SUT)->isInstanceOf('Hoa\Bench\Mark') | ||
->boolean($mark->isRunning())->isTrue() | ||
->boolean($mark->isPause())->isFalse() | ||
->assert('Stop mark') | ||
->when($SUT = $mark->stop()) | ||
->object($SUT)->isInstanceOf('Hoa\Bench\Mark') | ||
->boolean($mark->isRunning())->isFalse() | ||
->boolean($mark->isPause())->isFalse() | ||
; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
status = [ | ||
"continuous-integration/travis-ci/push" | ||
] | ||
timeout_sec = 1800 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters