Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
created vendor dir, updated test running config
  • Loading branch information
l3pp4rd committed Feb 1, 2011
1 parent 8bcfd7c commit 81edcf7
Show file tree
Hide file tree
Showing 54 changed files with 6,552 additions and 31 deletions.
15 changes: 15 additions & 0 deletions .gitmodules
@@ -0,0 +1,15 @@
[submodule "vendor/doctrine-common"]
path = vendor/doctrine-common
url = git://github.com/doctrine/common.git
[submodule "vendor/doctrine-dbal"]
path = vendor/doctrine-dbal
url = git://github.com/doctrine/dbal.git
[submodule "vendor/doctrine-orm"]
path = vendor/doctrine-orm
url = git://github.com/doctrine/doctrine2.git
[submodule "vendor/doctrine-mongodb"]
path = vendor/doctrine-mongodb
url = git://github.com/doctrine/mongodb.git
[submodule "vendor/doctrine-mongodb-odm"]
path = vendor/doctrine-mongodb-odm
url = git://github.com/doctrine/mongodb-odm.git
13 changes: 13 additions & 0 deletions README.markdown
Expand Up @@ -33,6 +33,19 @@ You can test these extensions on [my blog](http://gediminasm.org/test/ "Test doc

All tutorials for basic usage examples are on [my blog](http://gediminasm.org "Tutorials for extensions") also.

### Running the tests:

PHPUnit 3.4 or newer is required.
To setup and run tests follow these steps:

- go to the root directory of extensions
- run: **git submodule init**
- run: **git submodule update**
- go to tests directory: **cd tests**
- run: **phpunit**
- optional - you can **cp phpunit.dist.xml phpunit.xml** for additional modifications
- optional - run mongodb in background to complete all tests

### Thanks for contributions to:

- Christophe Coevoet [stof](http://github.com/stof)
Expand Down
59 changes: 31 additions & 28 deletions tests/bootstrap.php
@@ -1,51 +1,54 @@
<?php
/**
* This is bootstrap for phpUnit unit tests,
* make sure that your doctrine library structure looks like:
* /Doctrine
* /ORM
* /DBAL
* /Common
* use README.md for more details
*
* @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
* @package Gedmo.Tests
* @link http://www.gediminasm.org
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

if (!defined('DOCTRINE_LIBRARY_PATH')) {
die('path to doctrine library must be defined in phpunit.xml configuration');
}

// if empty string given, assume its in include path allready
if (strlen(DOCTRINE_LIBRARY_PATH)) {
set_include_path(implode(PATH_SEPARATOR, array(
realpath(DOCTRINE_LIBRARY_PATH),
get_include_path(),
)));
}
define('TESTS_PATH', __DIR__);
define('VENDOR_PATH', realpath(__DIR__ . '/../vendor'));

!defined('DS') && define('DS', DIRECTORY_SEPARATOR);
!defined('TESTS_PATH') && define('TESTS_PATH', __DIR__);
set_include_path(implode(PATH_SEPARATOR, array(
VENDOR_PATH,
get_include_path(),
)));

$classLoaderFile = 'Doctrine/Common/ClassLoader.php';
if (strlen(DOCTRINE_LIBRARY_PATH)) {
$classLoaderFile = DOCTRINE_LIBRARY_PATH . DS . $classLoaderFile;
if (!file_exists($classLoaderFile)) {
die('cannot find doctrine classloader, check the library path');
}
$classLoaderFile = VENDOR_PATH . '/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
if (!file_exists($classLoaderFile)) {
die('cannot find vendor, git submodule init && git submodule update');
}

require_once $classLoaderFile;
$classLoader = new Doctrine\Common\ClassLoader('Doctrine');
$classLoader = new Doctrine\Common\ClassLoader(
'Doctrine\ORM', 'doctrine-orm/lib'
);
$classLoader->register();

$classLoader = new Doctrine\Common\ClassLoader(
'Doctrine\DBAL', 'doctrine-dbal/lib'
);
$classLoader->register();

$classLoader = new Doctrine\Common\ClassLoader(
'Doctrine\MongoDB', 'doctrine-mongodb/lib'
);
$classLoader->register();

$classLoader = new Doctrine\Common\ClassLoader('Symfony', 'Doctrine');
$classLoader = new Doctrine\Common\ClassLoader(
'Doctrine\ODM', 'doctrine-mongodb-odm/lib'
);
$classLoader->register();

$classLoader = new Doctrine\Common\ClassLoader('Doctrine\ODM', 'Doctrine');
$classLoader = new Doctrine\Common\ClassLoader(
'Doctrine', 'doctrine-common/lib'
);
$classLoader->register();

$classLoader = new Doctrine\Common\ClassLoader('Doctrine\MongoDB', 'Doctrine');
$classLoader = new Doctrine\Common\ClassLoader('Symfony');
$classLoader->register();

$classLoader = new Doctrine\Common\ClassLoader('Gedmo', __DIR__ . '/../lib');
Expand Down
3 changes: 0 additions & 3 deletions tests/phpunit.dist.xml
Expand Up @@ -17,7 +17,4 @@
<directory suffix=".php">./Gedmo/Mapping/</directory>
</testsuite>
</testsuites>
<php>
<const name="DOCTRINE_LIBRARY_PATH" value="/path/to/library/where/Doctrine/located"/>
</php>
</phpunit>

0 comments on commit 81edcf7

Please sign in to comment.