Skip to content
Browse files

Added the travis-ci config

  • Loading branch information...
1 parent cd2e412 commit d55791b18644af1972907ea1caaf06e95cd695ad @stof stof committed Nov 15, 2011
Showing with 73 additions and 45 deletions.
  1. +4 −0 .gitignore
  2. +5 −0 .travis.yml
  3. +2 −22 phpunit.xml.dist
  4. +25 −0 tests/autoload.php.dist
  5. +4 −23 tests/bootstrap.php
  6. +33 −0 vendor/vendors.php
View
4 .gitignore
@@ -1 +1,5 @@
/phpunit.xml
+/tests/autoload.php
+/vendor/twig
+/vendor/pimple
+/vendor/Symfony
View
5 .travis.yml
@@ -0,0 +1,5 @@
+language: php
+php:
+ - 5.3
+ - 5.4
+before_script: php vendor/vendors.php
View
24 phpunit.xml.dist
@@ -1,20 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<phpunit backupGlobals="false"
- backupStaticAttributes="false"
- colors="false"
- convertErrorsToExceptions="true"
- convertNoticesToExceptions="true"
- convertWarningsToExceptions="true"
- processIsolation="false"
- stopOnFailure="false"
- syntaxCheck="false"
- bootstrap="tests/bootstrap.php"
->
-
+<phpunit colors="false" bootstrap="tests/bootstrap.php">
<testsuites>
<testsuite name="KnpMenu Test Suite">
- <directory>./tests/</directory>
+ <directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
@@ -23,13 +12,4 @@
<directory>./src</directory>
</whitelist>
</filter>
-
- <php>
- <!-- path to the Twig lib dir -->
- <const name="TWIG_LIB_DIR" value="NOT_SET" />
- <!-- path to the Pimple lib dir -->
- <const name="PIMPLE_LIB_DIR" value="NOT_SET" />
- <!-- path to the Symfony src dir -->
- <const name="SYMFONY_SRC_DIR" value="NOT_SET" />
- </php>
</phpunit>
View
25 tests/autoload.php.dist
@@ -0,0 +1,25 @@
+<?php
+
+$twig = __DIR__.'/../vendor/twig/lib/Twig/Autoloader.php';
+if (file_exists($twig)) {
+ require_once $twig;
+ Twig_Autoloader::register();
+}
+
+$pimple = __DIR__.'/../vendor/pimple/lib/Pimple.php';
+if (file_exists($pimple)) {
+ require_once $pimple;
+}
+
+spl_autoload_register(function($class) {
+ $namespaces = array('Knp\Menu\Tests' => __DIR__, 'Knp\Menu' => __DIR__.'/../src', 'Symfony' => __DIR__.'/../vendor/');
+ $class = ltrim($class, '\\');
+ foreach ($namespaces as $namespace => $dir) {
+ if (0 === strpos($class, $namespace)) {
+ $file = $dir.'/'.str_replace('\\', '/', $class).'.php';
+ if (file_exists($file)) {
+ require $file;
+ }
+ }
+ }
+});
View
27 tests/bootstrap.php
@@ -1,26 +1,7 @@
<?php
-if (defined('TWIG_LIB_DIR') && 'NOT_SET' !== TWIG_LIB_DIR) {
- require_once TWIG_LIB_DIR.'/Twig/Autoloader.php';
- Twig_Autoloader::register();
+if (file_exists($file = __DIR__.'/autoload.php')) {
+ require_once $file;
+} elseif (file_exists($file = __DIR__.'/autoload.php.dist')) {
+ require_once $file;
}
-
-if (defined('PIMPLE_LIB_DIR') && 'NOT_SET' !== PIMPLE_LIB_DIR) {
- require_once PIMPLE_LIB_DIR.'/Pimple.php';
-}
-
-spl_autoload_register(function($class) {
- $namespaces = array('Knp\Menu\Tests' => __DIR__, 'Knp\Menu' => __DIR__.'/../src');
- if (defined('SYMFONY_SRC_DIR') && 'NOT_SET' !== SYMFONY_SRC_DIR) {
- $namespaces['Symfony'] = SYMFONY_SRC_DIR;
- }
- $class = ltrim($class, '\\');
- foreach ($namespaces as $namespace => $dir) {
- if (0 === strpos($class, $namespace)) {
- $file = $dir.'/'.str_replace('\\', '/', $class).'.php';
- if (file_exists($file)) {
- require $file;
- }
- }
- }
-});
View
33 vendor/vendors.php
@@ -0,0 +1,33 @@
+#!/usr/bin/env php
+<?php
+
+/*
+ * This file is part of the FOSUserBundle package.
+ *
+ * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+set_time_limit(0);
+
+$vendorDir = __DIR__;
+$deps = array(
+ array('Symfony/Component/Routing', 'http://github.com/symfony/Routing.git', 'origin/master'),
+ array('twig', 'http://github.com/fabpot/Twig.git', 'origin/master'),
+ array('pimple', 'http://github.com/fabpot/Pimple.git', 'origin/master'),
+);
+
+foreach ($deps as $dep) {
+ list($name, $url, $rev) = $dep;
+
+ echo "> Installing/Updating $name\n";
+
+ $installDir = $vendorDir.'/'.$name;
+ if (!is_dir($installDir)) {
+ system(sprintf('git clone -q %s %s', escapeshellarg($url), escapeshellarg($installDir)));
+ }
+
+ system(sprintf('cd %s && git fetch -q origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev)));
+}

6 comments on commit d55791b

@stof
stof commented on d55791b Nov 15, 2011

@mbontemps Could you register the library in Travis ?

@mbontemps
KNP Labs member

It should be effective at next commit…

@stof
stof commented on d55791b Nov 15, 2011

you could even force the run from the admin panel of the repo (in the hook section) so that it runs

@stof
stof commented on d55791b Nov 15, 2011

@mbontemps why adding it twice, as knpEdgar and knplabs ? This duplicates the notifications.

@mbontemps
KNP Labs member

knpEdgar is a temporary account I needed because AFAIK you can't create an account for an organization…
But it seems that you can "cheat" by providing manually a travis hook… associated to a user.

@stof
stof commented on d55791b Nov 15, 2011

yeah, travis does not support configuring the hook for our organizations in their UI. This may be done in the future as the github API allow them to access the needed data but I guess it is not the higher priority as there is already a way to do this.

Please sign in to comment.
Something went wrong with that request. Please try again.