Skip to content
This repository
Browse code

Added the travis-ci config

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

6 comments on commit d55791b

Christophe Coevoet
Collaborator

@mbontemps Could you register the library in Travis ?

Matthieu Bontemps
Owner

It should be effective at next commit…

Christophe Coevoet
Collaborator

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

Christophe Coevoet
Collaborator

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

Matthieu Bontemps
Owner

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.

Christophe Coevoet
Collaborator

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.