Skip to content

Commit

Permalink
Added .travis.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
janpecha committed Nov 14, 2015
1 parent b1e6820 commit c362d2a
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 29 deletions.
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0

script:
- vendor/bin/tester -p php tests
- php -f temp/code-checker/src/code-checker.php

after_failure:
# Print *.actual content
- for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done

before_script:
# Install Nette Tester & Code Checker
- travis_retry composer update --no-interaction --prefer-dist
- travis_retry composer create-project nette/code-checker temp/code-checker ~2.5 --no-interaction

sudo: false
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
},
"require-dev": {
"nette/tester": "~1.2",
"nette/nette": "~2.2"
"nette/bootstrap": "~2.2",
"tracy/tracy": "~2.2"
},
"license": "BSD-3",
"autoload": {
Expand Down
38 changes: 20 additions & 18 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,28 @@
LeanMapper-extension
====================

LeanMapper extension for [Nette](http://nette.org) 2.2.
LeanMapper extension for [Nette](http://nette.org).


Installation
------------

[Download a latest package](https://github.com/janpecha/leanmapper-extension/releases) or use [Composer](http://getcomposer.org/):

```
composer require janpecha/leanmapper-extension
```

Extension requires:
* PHP 5.3 or later
* Nette 2.2 or later
* LeanMapper 2.2 or later


Usage
-----

```
``` yaml
extensions:
leanmapper: JP\LeanMapperExtension\LeanMapperExtension

Expand All @@ -26,7 +41,7 @@ Configuration

### Database connection

```
``` yaml
leanmapper:
# required
username: ...
Expand All @@ -44,7 +59,7 @@ leanmapper:

### Entities

```
``` yaml
leanmapper:
entityFactory: LeanMapper\DefaultEntityFactory
entities:
Expand All @@ -63,7 +78,7 @@ leanmapper:

### Mapper

```
``` yaml
leanmapper:
mapper: JP\LeanMapperExtension\Mapper
defaultEntityNamespace: 'Model\Entity'
Expand Down Expand Up @@ -111,19 +126,6 @@ $mapper->register($tableName, $entity = NULL, $repository = NULL, $primaryKey =
?>
```


Installation
------------

[Download a latest package](https://github.com/janpecha/leanmapper-extension/releases) or use [Composer](http://getcomposer.org/):

```
composer require janpecha/leanmapper-extension
```

Extension requires PHP 5.3 or later, Nette 2.2 and LeanMapper 2.2.


------------------------------

License: [New BSD License](license.md)
Expand Down
7 changes: 2 additions & 5 deletions tests/LeanMapperExtension/Extension.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test(function () {

Assert::same(array(
'host' => 'localhost',
'driver' => 'mysqli',
'driver' => 'fakeMysql',
'username' => 'foo',
'password' => 'bar',
'database' => 'foobar',
Expand All @@ -39,15 +39,12 @@ test(function () {

Assert::same(array(
'host' => '127.0.0.1',
'driver' => 'mysql',
'driver' => 'fakeMysql',
'username' => 'foo',
'password' => 'bar',
'database' => 'foobar',
'lazy' => TRUE,
), $config);

$profiler = $container->getByType('Dibi\Bridges\Tracy\Panel');
Assert::true($profiler instanceof Dibi\Bridges\Tracy\Panel);
});


Expand Down
2 changes: 2 additions & 0 deletions tests/LeanMapperExtension/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php
require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../../src/Mapper.php';
require __DIR__ . '/classes.php';

Tester\Environment::setup();

// create temporary directory
define('TEMP_DIR', __DIR__ . '/../tmp/' . (isset($_SERVER['argv']) ? md5(serialize($_SERVER['argv'])) : getmypid()));
@mkdir(TEMP_DIR, 0777, TRUE);
Tester\Helpers::purge(TEMP_DIR);


Expand Down
8 changes: 8 additions & 0 deletions tests/LeanMapperExtension/classes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

class DibiFakeMySqlDriver extends DibiMySqlDriver
{
public function __construct()
{
}
}
2 changes: 2 additions & 0 deletions tests/LeanMapperExtension/config/readme.addons.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ leanmapper:
user: foo
password: bar
database: foobar

driver: fakeMysql
2 changes: 2 additions & 0 deletions tests/LeanMapperExtension/config/readme.basic-usage.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ leanmapper:
user: foo
password: bar
database: foobar

driver: fakeMysql
2 changes: 1 addition & 1 deletion tests/LeanMapperExtension/config/readme.configuration.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ leanmapper:
# optional
connection: OwnConnection
host: 127.0.0.1
driver: mysql
driver: fakeMysql
lazy: true
profiler: true
1 change: 1 addition & 0 deletions tests/LeanMapperExtension/config/readme.entities.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

leanmapper:
driver: fakeMysql
entities:
user: UserEntity

Expand Down
3 changes: 0 additions & 3 deletions tests/php-unix.ini

This file was deleted.

2 changes: 1 addition & 1 deletion tests/run-tests-unix.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

../vendor/bin/tester -c php-unix.ini -p php -j 20
../vendor/bin/tester -p php -j 20

0 comments on commit c362d2a

Please sign in to comment.