Skip to content

Commit

Permalink
Added the travis-ci config
Browse files Browse the repository at this point in the history
  • Loading branch information
stof committed Nov 15, 2011
1 parent cd2e412 commit d55791b
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 45 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -1 +1,5 @@
/phpunit.xml /phpunit.xml
/tests/autoload.php
/vendor/twig
/vendor/pimple
/vendor/Symfony
5 changes: 5 additions & 0 deletions .travis.yml
@@ -0,0 +1,5 @@
language: php
php:
- 5.3
- 5.4
before_script: php vendor/vendors.php
24 changes: 2 additions & 22 deletions phpunit.xml.dist
@@ -1,20 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>


<phpunit backupGlobals="false" <phpunit colors="false" bootstrap="tests/bootstrap.php">
backupStaticAttributes="false"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
>

<testsuites> <testsuites>
<testsuite name="KnpMenu Test Suite"> <testsuite name="KnpMenu Test Suite">
<directory>./tests/</directory> <directory suffix="Test.php">./tests/</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>


Expand All @@ -23,13 +12,4 @@
<directory>./src</directory> <directory>./src</directory>
</whitelist> </whitelist>
</filter> </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> </phpunit>
25 changes: 25 additions & 0 deletions 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;
}
}
}
});
27 changes: 4 additions & 23 deletions tests/bootstrap.php
@@ -1,26 +1,7 @@
<?php <?php


if (defined('TWIG_LIB_DIR') && 'NOT_SET' !== TWIG_LIB_DIR) { if (file_exists($file = __DIR__.'/autoload.php')) {
require_once TWIG_LIB_DIR.'/Twig/Autoloader.php'; require_once $file;
Twig_Autoloader::register(); } 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;
}
}
}
});
33 changes: 33 additions & 0 deletions 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
Copy link
Collaborator Author

@stof stof commented on d55791b Nov 15, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mbontemps Could you register the library in Travis ?

@mbontemps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be effective at next commit…

@stof
Copy link
Collaborator Author

@stof stof commented on d55791b Nov 15, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@stof
Copy link
Collaborator Author

@stof stof commented on d55791b Nov 15, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@mbontemps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Collaborator Author

@stof stof commented on d55791b Nov 15, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.