Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
Merge pull request #17 from vonglasow/tests
Browse files Browse the repository at this point in the history
Add first test for Mark class.
  • Loading branch information
vonglasow committed Jun 27, 2018
2 parents b9fa297 + 4a7f3cf commit 594e8e8
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .travis.yml
@@ -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
82 changes: 82 additions & 0 deletions Test/Unit/Mark.php
@@ -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()
;
}
}
4 changes: 4 additions & 0 deletions bors.toml
@@ -0,0 +1,4 @@
status = [
"continuous-integration/travis-ci/push"
]
timeout_sec = 1800
3 changes: 3 additions & 0 deletions composer.json
Expand Up @@ -28,6 +28,9 @@
"hoa/exception" : "~1.0",
"hoa/iterator" : "~2.0"
},
"require-dev": {
"hoa/test" : "~2.0"
},
"autoload": {
"psr-4": {
"Hoa\\Bench\\": "."
Expand Down

0 comments on commit 594e8e8

Please sign in to comment.