Skip to content

Commit 4f09fd9

Browse files
committed
Merge pull request #22 from Hounddog/travis
Travis
2 parents a3d8a30 + 29c5ab1 commit 4f09fd9

File tree

10 files changed

+102
-17
lines changed

10 files changed

+102
-17
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/build
2+
/vendor
3+
composer.lock
4+
composer.phar

.travis.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
language: php
2+
php:
3+
- 5.4
4+
- 5.5
5+
6+
before_script:
7+
- composer self-update
8+
- composer update --prefer-source; composer install --dev --prefer-source;
9+
10+
script:
11+
- ./vendor/bin/phpunit --coverage-clover ./build/logs/clover.xml
12+
- ./vendor/bin/phpcs --standard=PSR2 ./src/ ./tests/
13+
14+
after_script:
15+
- php vendor/bin/coveralls -v
16+
17+
notifications:
18+
irc: "irc.freenode.org#zftalk.modules"
19+
email: false

Module.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
/**
33
* This file is placed here for compatibility with Zendframework 2's ModuleManager.
44
* It allows usage of this module even without composer.
5-
* The original Module.php is in 'src/DoctrineORMModule' in order to respect PSR-0
5+
* The original Module.php is in 'src/DoctrineDataFixtureModule' in order to respect PSR-0
66
*/
7-
require_once __DIR__ . '/src/DoctrineDataFixtureModule/Module.php';
7+
require_once __DIR__ . '/src/DoctrineDataFixtureModule/Module.php';

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# DoctrineDataFixture Module for Zend Framework 2
22

3+
[![Build Status](https://travis-ci.org/Hounddog/DoctrineDataFixtureModule.png)](https://travis-ci.org/Hounddog/DoctrineDataFixtureModule)
4+
[![Coverage Status](https://coveralls.io/repos/Hounddog/DoctrineDataFixtureModule/badge.png?branch=master)](https://coveralls.io/r/Hounddog/DoctrineDataFixtureModule)
5+
6+
## Introduction
7+
38
The DoctrineDataFixtureModule module intends to integrate Doctrine 2 data-fixture with Zend Framework 2 quickly
49
and easily. The following features are intended to work out of the box:
510

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
"doctrine/data-fixtures": "1.0.*",
2525
"doctrine/doctrine-orm-module": "~0.7"
2626
},
27+
"require-dev": {
28+
"phpunit/phpunit" : "3.7.*",
29+
"satooshi/php-coveralls": ">=0.6.0",
30+
"squizlabs/php_codesniffer": "1.4.*"
31+
},
2732
"autoload": {
2833
"psr-0": {
2934
"DoctrineDataFixtureModule": "src/"

phpunit.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0"?>
2+
<!-- works fine with PHPUnit-3.6.10 -->
3+
<phpunit
4+
bootstrap="./tests/Bootstrap.php"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
verbose="true"
10+
stopOnFailure="false"
11+
processIsolation="false"
12+
backupGlobals="false"
13+
syntaxCheck="true"
14+
>
15+
<testsuite name="DoctrineDataFixture Module Tests">
16+
<directory>./tests/DoctrineDataFixtureTest</directory>
17+
</testsuite>
18+
<filter>
19+
<whitelist addUncoveredFilesFromWhitelist="true">
20+
<directory suffix=".php">./src</directory>
21+
</whitelist>
22+
</filter>
23+
<logging>
24+
<log
25+
type="coverage-clover"
26+
target="./clover.xml"
27+
/>
28+
</logging>
29+
</phpunit>

src/DoctrineDataFixtureModule/Command/ImportCommand.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@
1919

2020
namespace DoctrineDataFixtureModule\Command;
2121

22-
use Symfony\Component\Console\Command\Command,
23-
Symfony\Component\Console\Input\InputInterface,
24-
Symfony\Component\Console\Output\OutputInterface,
25-
Symfony\Component\Console\Input\InputArgument,
26-
Symfony\Component\Console\Input\InputOption,
27-
Doctrine\ORM\Tools\SchemaTool,
28-
Doctrine\DBAL\Migrations\Configuration\Configuration;
29-
22+
use Symfony\Component\Console\Command\Command;
23+
use Symfony\Component\Console\Input\InputInterface;
24+
use Symfony\Component\Console\Output\OutputInterface;
25+
use Symfony\Component\Console\Input\InputArgument;
26+
use Symfony\Component\Console\Input\InputOption;
27+
use Doctrine\ORM\Tools\SchemaTool;
28+
use Doctrine\DBAL\Migrations\Configuration\Configuration;
3029
use Doctrine\Common\DataFixtures\Loader;
3130
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
3231
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
32+
3333
/**
3434
* Command for generate migration classes by comparing your current database schema
3535
* to your mapping information.
@@ -53,7 +53,8 @@ protected function configure()
5353

5454
$this->setName('data-fixture:import')
5555
->setDescription('Import Data Fixtures')
56-
->setHelp(<<<EOT
56+
->setHelp(
57+
<<<EOT
5758
The import command Imports data-fixtures
5859
EOT
5960
)
@@ -66,19 +67,19 @@ public function execute(InputInterface $input, OutputInterface $output)
6667
$loader = new Loader();
6768
$purger = new ORMPurger();
6869

69-
if($input->getOption('purge-with-truncate')) {
70+
if ($input->getOption('purge-with-truncate')) {
7071
$purger->setPurgeMode(self::PURGE_MODE_TRUNCATE);
7172
}
7273

7374
$executor = new ORMExecutor($this->em, $purger);
7475

75-
foreach($this->paths as $key => $value) {
76+
foreach ($this->paths as $key => $value) {
7677
$loader->loadFromDirectory($value);
7778
}
7879
$executor->execute($loader->getFixtures(), $input->getOption('append'));
7980
}
8081

81-
public function setPath($paths)
82+
public function setPath($paths)
8283
{
8384
$this->paths=$paths;
8485
}

src/DoctrineDataFixtureModule/Module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function init(ModuleManager $e)
6262
$events = $e->getEventManager()->getSharedManager();
6363

6464
// Attach to helper set event and load the entity manager helper.
65-
$events->attach('doctrine', 'loadCli.post', function(EventInterface $e) {
65+
$events->attach('doctrine', 'loadCli.post', function (EventInterface $e) {
6666
/* @var $cli \Symfony\Component\Console\Application */
6767
$cli = $e->getTarget();
6868

src/DoctrineDataFixtureModule/Service/FixtureFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function createService(ServiceLocatorInterface $sl)
5252
public function getOptions(ServiceLocatorInterface $sl, $key)
5353
{
5454
$options = $sl->get('Configuration');
55-
if(!isset($options['data-fixture'])) {
55+
if (!isset($options['data-fixture'])) {
5656
return array();
5757
}
5858

@@ -61,6 +61,6 @@ public function getOptions(ServiceLocatorInterface $sl, $key)
6161

6262
public function getOptionsClass()
6363
{
64-
return 'DoctrineDataFixtureModule\Options\Fixture';
64+
return 'DoctrineDataFixtureModule\Options\Fixture';
6565
}
6666
}

tests/Bootstrap.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
ini_set('error_reporting', E_ALL | E_STRICT);
4+
5+
$files = array(__DIR__ . '/../vendor/autoload.php', __DIR__ . '/../../../autoload.php');
6+
7+
foreach ($files as $file) {
8+
if (file_exists($file)) {
9+
$loader = require $file;
10+
11+
break;
12+
}
13+
}
14+
15+
if (! isset($loader)) {
16+
throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?');
17+
}
18+
19+
/* @var $loader \Composer\Autoload\ClassLoader */
20+
$loader->add('DoctrineDataFixtureTest\\', __DIR__);
21+
22+
unset($files, $file, $loader);

0 commit comments

Comments
 (0)