Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 512c1f1

Browse files
committed
Added travis CI
1 parent 081a3a4 commit 512c1f1

File tree

6 files changed

+95
-18
lines changed

6 files changed

+95
-18
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
phpunit.xml
2+
Tests/autoload.php
3+
4+
vendor/symfony

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
language: php
2+
3+
php:
4+
- 5.3
5+
- 5.4
6+
7+
env:
8+
- SYMFONY_VERSION=v2.0.6
9+
- SYMFONY_VERSION=origin/master
10+
11+
before_script: php vendor/vendors.php
12+
13+
notifications:
14+
email:
15+
- friendsofsymfony-dev@googlegroups.com

Tests/autoload.php.dist

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the FOSAdvancedEncoderBundle package.
5+
*
6+
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
$vendorDir = __DIR__.'/../vendor';
13+
require_once $vendorDir.'/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
14+
15+
use Symfony\Component\ClassLoader\UniversalClassLoader;
16+
17+
$loader = new UniversalClassLoader();
18+
$loader->registerNamespaces(array(
19+
'Symfony' => $vendorDir.'/symfony/src',
20+
));
21+
$loader->register();
22+
23+
spl_autoload_register(function($class) {
24+
if (0 === strpos($class, 'FOS\\AdvancedEncoderBundle\\')) {
25+
$path = __DIR__.'/../'.implode('/', array_slice(explode('\\', $class), 2)).'.php';
26+
if (!stream_resolve_include_path($path)) {
27+
return false;
28+
}
29+
require_once $path;
30+
return true;
31+
}
32+
});

Tests/bootstrap.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
<?php
22

3-
require_once $_SERVER['SYMFONY'].'/Symfony/Component/ClassLoader/UniversalClassLoader.php';
3+
/*
4+
* This file is part of the FOSAdvancedEncoderBundle package.
5+
*
6+
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
411

5-
use Symfony\Component\ClassLoader\UniversalClassLoader;
6-
7-
$loader = new UniversalClassLoader();
8-
$loader->registerNamespace('Symfony', $_SERVER['SYMFONY']);
9-
$loader->register();
10-
11-
spl_autoload_register(function($class) {
12-
if (0 === strpos($class, 'FOS\\AdvancedEncoderBundle\\')) {
13-
$path = implode('/', array_slice(explode('\\', $class), 2)).'.php';
14-
require_once __DIR__.'/../'.$path;
15-
16-
return true;
17-
}
18-
});
12+
if (file_exists($file = __DIR__.'/autoload.php')) {
13+
require_once $file;
14+
} elseif (file_exists($file = __DIR__.'/autoload.php.dist')) {
15+
require_once $file;
16+
}

phpunit.xml.dist

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<phpunit bootstrap="./Tests/bootstrap.php" color="true">
4-
<php>
5-
<server name="SYMFONY" value="../../../symfony/src" />
6-
</php>
74
<testsuites>
85
<testsuite name="FOSAdvancedEncoderBundle">
96
<directory suffix="Test.php">./Tests</directory>
@@ -16,6 +13,7 @@
1613
<exclude>
1714
<directory>./Resources</directory>
1815
<directory>./Tests</directory>
16+
<directory>./vendor</directory>
1917
</exclude>
2018
</whitelist>
2119
</filter>

vendor/vendors.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
/*
5+
* This file is part of the FOSAdvancedEncoderBundle 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', 'http://github.com/symfony/symfony', isset($_SERVER['SYMFONY_VERSION']) ? $_SERVER['SYMFONY_VERSION'] : 'origin/master'),
18+
);
19+
20+
foreach ($deps as $dep) {
21+
list($name, $url, $rev) = $dep;
22+
23+
echo "> Installing/Updating $name\n";
24+
25+
$installDir = $vendorDir.'/'.$name;
26+
if (!is_dir($installDir)) {
27+
system(sprintf('git clone -q %s %s', escapeshellarg($url), escapeshellarg($installDir)));
28+
}
29+
30+
system(sprintf('cd %s && git fetch -q origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev)));
31+
}

0 commit comments

Comments
 (0)