Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Enable Travis CI and refactor test bootstrap

  • Loading branch information...
commit cac7e11f5cf91c072593beadd354ec242129ad8c 1 parent 0252418
@jmikola jmikola authored
Showing with 24 additions and 12 deletions.
  1. +17 −0 .travis.yml
  2. +7 −12 Tests/bootstrap.php
View
17 .travis.yml
@@ -0,0 +1,17 @@
+language: php
+
+php:
+ - 5.3
+ - 5.4
+env:
+ - DB=mongodb
@stof Collaborator
stof added a note

you don't need it as you don't provide different values

@jmikola Owner
jmikola added a note

What exactly is unnecessary, DB=mongodb?

@stof Collaborator
stof added a note

because you don't use this env param anywhere

@jmikola Owner
jmikola added a note

Ah, I didn't realize all of the databases were available by default: http://about.travis-ci.org/docs/user/database-setup/

This was more copying of mongodb-odm's config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
+before_script:
+ - wget http://pecl.php.net/get/mongo-1.2.7.tgz
+ - tar -xzf mongo-1.2.7.tgz
+ - sh -c "cd mongo-1.2.7 && phpize && ./configure --enable-mongo && make && sudo make install"
+ - echo "extension=mongo.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
+ - wget -nc http://getcomposer.org/composer.phar
+ - php composer.phar install
+
+script: phpunit -c .
@stof Collaborator
stof added a note

you can remove it as loading the config from the current folder is the default, meaning it is the same than phpunit, which is already the script called by Travis by default

@jmikola Owner
jmikola added a note

Point noted, as in http://about.travis-ci.org/docs/user/languages/php/. I wasn't aware of that default (this was just copying mongodb-odm).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
View
19 Tests/bootstrap.php
@@ -1,17 +1,12 @@
<?php
-use Doctrine\Common\Annotations\AnnotationRegistry;
-
-if (!$loader = @include __DIR__ . '/../vendor/.composer/autoload.php') {
- die("You must set up the project dependencies, run the following commands:
-wget http://getcomposer.org/composer.phar
-php composer.phar install
-");
+$file = __DIR__.'/../vendor/autoload.php';
+if (!file_exists($file)) {
+ throw new RuntimeException('Install dependencies to run test suite.');
}
-AnnotationRegistry::registerLoader(function($class) use ($loader) {
- $loader->loadClass($class);
- return class_exists($class, false);
-});
+require_once $file;
+
+use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver;
-AnnotationRegistry::registerFile(__DIR__ . '/../vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/Annotations/DoctrineAnnotations.php');
+AnnotationDriver::registerAnnotationClasses();
Please sign in to comment.
Something went wrong with that request. Please try again.