Permalink
Browse files

Enable Travis CI and refactor test bootstrap

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

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

@jmikola
jmikola May 17, 2012 Member

What exactly is unnecessary, DB=mongodb?

@stof
stof May 17, 2012 Member

because you don't use this env param anywhere

@jmikola
jmikola May 17, 2012 Member

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.

+
+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
stof May 17, 2012 Member

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
jmikola May 17, 2012 Member

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).

View
@@ -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();

0 comments on commit cac7e11

Please sign in to comment.