Skip to content

Commit

Permalink
first steps towards testing on travis using composer
Browse files Browse the repository at this point in the history
  • Loading branch information
lsmith77 committed Mar 17, 2012
1 parent 29b015e commit 46047bb
Show file tree
Hide file tree
Showing 26 changed files with 61 additions and 255 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ nbproject
*~
tests/phpunit.xml

lib/vendor
/cli-config.php
jackrabbit/

vendor/

composer.lock
composer.phar
12 changes: 0 additions & 12 deletions .gitmodules

This file was deleted.

2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ env:
# - TRANSPORT=midgard_mysql

before_script:
- wget -nc http://getcomposer.org/composer.phar
- php composer.phar install --install-suggests
- ./tests/travis_${TRANSPORT}.sh

script: phpunit -c tests/phpunit_${TRANSPORT}.xml.dist
Expand Down
38 changes: 38 additions & 0 deletions bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

$vendorDir = __DIR__.'/vendor';

spl_autoload_register(function($class)
{
if (0 === strpos($class, 'Doctrine\ODM\PHPCR')) {
$path = __DIR__.'/lib/'.implode('/', explode('\\', $class)).'.php';
if (!stream_resolve_include_path($path)) {
return false;
}
require_once $path;
return true;
}
if (0 === strpos($class, 'Doctrine\Tests')) {
$path = __DIR__.'/tests/'.implode('/', explode('\\', $class)).'.php';
if (!stream_resolve_include_path($path)) {
return false;
}
require_once $path;
return true;
}
});

$file = $vendorDir.'/.composer/autoload.php';
if (file_exists($file)) {
$autoload = require_once $file;
} else {
throw new RuntimeException('Install dependencies to run test suite.');
}

use Doctrine\Common\Annotations\AnnotationRegistry;

AnnotationRegistry::registerLoader(function($class) use ($autoload) {
$autoload->loadClass($class);
return class_exists($class, false);
});
AnnotationRegistry::registerFile(__DIR__.'/lib/Doctrine/ODM/PHPCR/Mapping/Annotations/DoctrineAnnotations.php');
18 changes: 2 additions & 16 deletions cli-config.doctrine_dbal.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,9 @@
* Add instances of commands for eventual implementation specific commands to this array.
*/

$extraCommands = array();

$vendorDir = __DIR__.'/lib/vendor';

require_once $vendorDir.'/phpcr-utils/lib/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php';
$classLoader = new \Symfony\Component\ClassLoader\UniversalClassLoader();
$classLoader->register();

$classLoader->registerNamespaces(array(
'Doctrine\ODM' => dirname($vendorDir),
'Doctrine\Common' => $vendorDir.'/doctrine-common/lib',
'Symfony' => array($vendorDir.'/jackalope-doctrine-dbal/lib/jackalope/lib/phpcr-utils/lib/vendor'),
'PHPCR' => array($vendorDir.'/phpcr/src', $vendorDir.'/phpcr-utils/src'),
'Jackalope'=> array($vendorDir.'/jackalope-doctrine-dbal/src', $vendorDir.'/jackalope-doctrine-dbal/lib/jackalope/src'),
'Doctrine\DBAL'=> $vendorDir.'/jackalope-doctrine-dbal/lib/vendor/doctrine-dbal/lib',
));
require_once './bootstrap.php';

$extraCommands = array();
$extraCommands[] = new \Jackalope\Tools\Console\Command\InitDoctrineDbalCommand();

$params = array(
Expand Down
17 changes: 2 additions & 15 deletions cli-config.jackrabbit.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,9 @@
* Add instances of commands for eventual implementation specific commands to this array.
*/

$extraCommands = array();

$vendorDir = __DIR__.'/lib/vendor';

require_once $vendorDir.'/phpcr-utils/lib/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php';
$classLoader = new \Symfony\Component\ClassLoader\UniversalClassLoader();
$classLoader->register();

$classLoader->registerNamespaces(array(
'Doctrine\ODM' => dirname($vendorDir),
'Doctrine\Common' => $vendorDir.'/doctrine-common/lib',
'Symfony' => array($vendorDir.'/phpcr-utils/lib/vendor'),
'PHPCR' => array($vendorDir.'/phpcr/src', $vendorDir.'/phpcr-utils/src'),
'Jackalope'=> array($vendorDir.'/jackalope-jackrabbit/src', $vendorDir.'/jackalope-jackrabbit/lib/jackalope/src'),
));
require_once './bootstrap.php';

$extraCommands = array();
$extraCommands[] = new \Jackalope\Tools\Console\Command\JackrabbitCommand();

$params = array(
Expand Down
16 changes: 2 additions & 14 deletions cli-config.midgard_mysql.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,9 @@
* Add instances of commands for eventual implementation specific commands to this array.
*/

$extraCommands = array();

$vendorDir = __DIR__.'/lib/vendor';

require_once $vendorDir.'/jackalope/lib/phpcr-utils/lib/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php';
$classLoader = new \Symfony\Component\ClassLoader\UniversalClassLoader();
$classLoader->register();
require_once './bootstrap.php';

$classLoader->registerNamespaces(array(
'Doctrine\ODM' => dirname($vendorDir),
'Doctrine\Common' => $vendorDir.'/doctrine-common/lib',
'Symfony' => array($vendorDir.'/jackalope/lib/phpcr-utils/lib/vendor'),
'PHPCR' => array($vendorDir.'/phpcr/src', $vendorDir.'/phpcr-utils/src'),
'Midgard\PHPCR' => __DIR__ . '/lib/vendor/Midgard/PHPCR/src'
));
$extraCommands = array();

$params = array(
'midgard2.configuration.db.type' => 'MySQL',
Expand Down
15 changes: 2 additions & 13 deletions cli-config.midgard_sqlite.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,9 @@
* Add instances of commands for eventual implementation specific commands to this array.
*/

$extraCommands = array();

$vendorDir = __DIR__.'/lib/vendor';

require_once $vendorDir.'/jackalope/lib/phpcr-utils/lib/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php';
$classLoader = new \Symfony\Component\ClassLoader\UniversalClassLoader();
$classLoader->register();
require_once './bootstrap.php';

$classLoader->registerNamespaces(array(
'Doctrine\ODM' => dirname($vendorDir),
'Doctrine\Common' => $vendorDir.'/doctrine-common/lib',
'Symfony' => array($vendorDir, $vendorDir.'/jackalope/lib/phpcr-utils/lib/vendor'),
'PHPCR' => array($vendorDir.'/jackalope/lib/phpcr/src', $vendorDir.'/jackalope/lib/phpcr-utils/src'),
));
$extraCommands = array();

$classLoader->registerNamespaces(array(
'Midgard\PHPCR' => __DIR__ . '/lib/vendor/Midgard/PHPCR/src'
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
"php": ">=5.3.2",
"doctrine/common": "dev-master",
"phpcr/phpcr-implementation": "2.1.0-beta3",
"phpcr/phpcr-utils": "1.0-beta2"
"phpcr/phpcr-utils": "dev-master"
},
"suggest": {
"symfony/yaml": ">=2.0.0,<2.2.0-dev"
"symfony/yaml": ">=2.0.0,<2.2.0-dev",
"jackalope/jackalope-jackrabbit": "dev-master"
},
"autoload": {
"psr-0": { "Doctrine\\ODM\\PHPCR": "lib/" }
Expand Down
1 change: 0 additions & 1 deletion lib/vendor/Symfony/Component/Yaml
Submodule Yaml deleted from 1eaee0
1 change: 0 additions & 1 deletion lib/vendor/doctrine-common
Submodule doctrine-common deleted from 38c854
1 change: 0 additions & 1 deletion lib/vendor/phpcr
Submodule phpcr deleted from a1ebfa
1 change: 0 additions & 1 deletion lib/vendor/phpcr-utils
Submodule phpcr-utils deleted from 778846
37 changes: 0 additions & 37 deletions tests/bootstrap.php

This file was deleted.

21 changes: 0 additions & 21 deletions tests/bootstrap_doctrine_dbal.php

This file was deleted.

22 changes: 0 additions & 22 deletions tests/bootstrap_jackrabbit.php

This file was deleted.

14 changes: 0 additions & 14 deletions tests/bootstrap_midgard.php

This file was deleted.

2 changes: 1 addition & 1 deletion tests/phpunit_doctrine_dbal.xml.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<phpunit bootstrap="./bootstrap_doctrine_dbal.php">
<phpunit bootstrap="../bootstrap.php">
<php>
<var name="DOCTRINE_PHPCR_FACTORY" value="\Jackalope\RepositoryFactoryDoctrineDBAL" />
<var name="jackalope.doctrine.dbal.driver" value="pdo_mysql" />
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit_jackrabbit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<phpunit bootstrap="./bootstrap_jackrabbit.php">
<phpunit bootstrap="../bootstrap.php">
<php>
<var name="DOCTRINE_PHPCR_FACTORY" value="\Jackalope\RepositoryFactoryJackrabbit" />
<var name="jackalope.jackrabbit_uri" value="http://localhost:8080/server/" />
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit_midgard_mysql.xml.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<phpunit bootstrap="./bootstrap_midgard.php">
<phpunit bootstrap="../bootstrap.php">
<php>
<var name="DOCTRINE_PHPCR_FACTORY" value="\Midgard\PHPCR\RepositoryFactory" />
<var name="midgard2.configuration.db.type" value="MySQL" />
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit_midgard_sqlite.xml.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<phpunit bootstrap="./bootstrap_midgard.php">
<phpunit bootstrap="../bootstrap.php">
<php>
<var name="DOCTRINE_PHPCR_FACTORY" value="\Midgard\PHPCR\RepositoryFactory" />
<var name="midgard2.configuration.db.type" value="SQLite" />
Expand Down
5 changes: 0 additions & 5 deletions tests/travis_doctrine_dbal.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
#!/bin/bash

git submodule update --init --recursive

mysql -e 'create database IF NOT EXISTS phpcr_odm_tests;' -u root

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
php $DIR/vendor/vendors_doctrine_dbal.php

cp cli-config.doctrine_dbal.php.dist cli-config.php
./bin/phpcr jackalope:init:dbal
./bin/phpcr doctrine:phpcr:register-system-node-types
7 changes: 1 addition & 6 deletions tests/travis_jackrabbit.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#!/bin/bash

git submodule update --init --recursive

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
php $DIR/vendor/vendors_jackrabbit.php

./lib/vendor/jackalope-jackrabbit/tests/travis.sh
./vendor/jackalope/jackalope-jackrabbit/tests/travis.sh

cp cli-config.jackrabbit.php.dist cli-config.php
./bin/phpcr doctrine:phpcr:register-system-node-types
23 changes: 0 additions & 23 deletions tests/vendor/vendors_doctrine_dbal.php

This file was deleted.

23 changes: 0 additions & 23 deletions tests/vendor/vendors_jackrabbit.php

This file was deleted.

Loading

0 comments on commit 46047bb

Please sign in to comment.