Skip to content

Commit

Permalink
Running test using phpunit from composer
Browse files Browse the repository at this point in the history
  • Loading branch information
mthenw committed May 30, 2013
1 parent bfe3ebe commit b472cc6
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
vendor
composer.lock
5 changes: 3 additions & 2 deletions .travis.yml
Expand Up @@ -4,5 +4,6 @@ php:
- 5.4
env:
- DB=sqlite
before_install:
git submodule init && git submodule --quiet update
before_script:
- composer install --dev --no-interaction
- make test
10 changes: 10 additions & 0 deletions README.md
Expand Up @@ -58,6 +58,16 @@ NoSQLite is simple key-value store using SQLite as raw data store. Mainly for sm

count($store);

## Running tests

PHPUnit is required as dev package in ```composer.json``` so test should be run using

./vendor/bin/phpunit

or simply

make test

## License

(The MIT License)
Expand Down
3 changes: 3 additions & 0 deletions composer.json
Expand Up @@ -15,6 +15,9 @@
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "3.7.*@stable"
},
"autoload": {
"psr-0": { "NoSQLite": "src/" }
}
Expand Down
4 changes: 4 additions & 0 deletions makefile
@@ -0,0 +1,4 @@
test:
@./vendor/bin/phpunit

.PHONY: test
9 changes: 7 additions & 2 deletions phpunit.xml.dist
@@ -1,10 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="tests/bootstrap.php">
<phpunit>
<testsuites>
<testsuite name="nosqlite-php Test Suite">
<directory>./tests/</directory>
<directory>./test</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src/NoSQLite</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/>
</logging>
Expand Down
6 changes: 4 additions & 2 deletions src/NoSQLite/Store.php
Expand Up @@ -13,6 +13,8 @@
*/

namespace NoSQLite;
use PDO;
use PDOStatement;

/**
* Class Store
Expand Down Expand Up @@ -106,7 +108,7 @@ protected function createTable()
*
* @param string $key key
*
* @throws InvalidArgumentException
* @throws \InvalidArgumentException
* @return string|null
*/
public function get($key)
Expand Down Expand Up @@ -160,7 +162,7 @@ public function getAll()
* @param string $value value
*
* @return string value stored
* @throws InvalidArgumentException
* @throws \InvalidArgumentException
*/
public function set($key, $value)
{
Expand Down
File renamed without changes.
Expand Up @@ -32,12 +32,12 @@ class StoreTest extends \PHPUnit_Framework_TestCase
const DB_FILE = 'storeTest.db';

/**
* @var NoSQLite\NoSQLite
* @var NoSQLite
*/
protected $nsl;

/**
* @var NoSQLite\Store
* @var Store
*/
protected $store;

Expand Down Expand Up @@ -125,7 +125,7 @@ public function testUpdateValue()
* @param string $value value
*
* @dataProvider invalidSetData
* @expectedException InvalidArgumentException
* @expectedException \InvalidArgumentException
* @return void
*/
public function testSetExceptions($key, $value)
Expand All @@ -140,7 +140,7 @@ public function testSetExceptions($key, $value)
* @param string $key key
*
* @dataProvider invalidGetData
* @expectedException InvalidArgumentException
* @expectedException \InvalidArgumentException
* @return void
*/
public function testGetExceptions($key)
Expand Down
18 changes: 0 additions & 18 deletions tests/bootstrap.php

This file was deleted.

0 comments on commit b472cc6

Please sign in to comment.