Skip to content

Commit

Permalink
1. Bugs fixed
Browse files Browse the repository at this point in the history
2. Code coverage brought to 100%
3. Coveralls test coverage monitoring added
  • Loading branch information
coa committed Sep 27, 2015
1 parent 76dbb4d commit 6ac0de1
Show file tree
Hide file tree
Showing 81 changed files with 1,672 additions and 756 deletions.
14 changes: 11 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ language: php
php:
- 5.5
- 5.4
services:
- mongodb

before_script:
- mkdir -p build/logs
- composer install
- echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
script: vendor/phpunit/phpunit/phpunit test/

services:
- mongodb

script:
- vendor/phpunit/phpunit/phpunit --coverage-clover build/logs/clover.xml test/

after_success:
- php vendor/bin/coveralls -v
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
1.0.0
==============================
Bugs fixed
Code coverage brought to 100%
Coveralls test coverage monitoring added
56 changes: 52 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,60 @@ Requirements

You'll need: PHP version 5.4+

Quickstart
==========
Installation
============
Install the latest version with composer:<br/>
```
require "ajant/db-mock-library"
```

Auto-load the library:
```php
use DbMockLibrary/DbMockLibrary

As of now MySQL and MongoDb databases have been implemented.
```

As of now MySQL and MongoDb databases have been implemented.

Quick start
===========
Here's the example, how to use the library for testing MySQL features of the application

Bootstrapping:
```php
...
// 2 tables, 2 rows each
$data = [
'table_1' => [
-1 => ['foo' => 20, 'id' => -1],
-2 => ['foo' => 50, 'id' => -2]
],
'table_2' => [
-1 => ['bar' => 30, 'id' => -1, 'table_1_id' => -1],
-2 => ['bar' => 10, 'id' => -2, 'table_1_id' => -2]
]
];
// table_1_id is foreign key, referencing id column
$dependencies = [
[
DependencyHandler::DEPENDENT => ['table_2' => 'table_1_id'],
DependencyHandler::ON => ['table_1' => 'id']
]
];
// initialize MySQL
MySQL::initMySQL($data, 'localhost', 'DbMockLibraryTest', 'root', '', $dependencies);
...
```
Test set up:
```php
...
// inserts both rows of table_2 and both rows of table_1, because
MySQL::getInstance()->setUp(['table_2' => [-1, -2]]);
...
```
Test tear down:
```php
...
// removes all rows inserted during set up phase
MySQL::getInstance()->cleanUp();
...
```
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "ajant/db-mock-library",
"description": "Db mocking & stabbing library",
"authors": [
{
"name": "Jovanovic Aleksandar",
Expand All @@ -15,12 +14,14 @@
"ajant/simple-array-library": ">=1.0.0"
},
"require-dev": {
"phpunit/phpunit": "4.*"
"phpunit/phpunit": "4.*",
"satooshi/php-coveralls": "dev-master",
"mockery/mockery": "dev-master"
},
"autoload": {
"psr-4": {
"DbMockLibrary\\": "src",
"Test\\": "test"
"DbMockLibrary\\Test\\": "test"
}
}
}
Loading

0 comments on commit 6ac0de1

Please sign in to comment.