Skip to content

Commit

Permalink
[testing] configure bundle to test it on travis-CI
Browse files Browse the repository at this point in the history
  • Loading branch information
David Epely committed Jul 3, 2012
1 parent ed31d10 commit 5486c8c
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
*~
Tests/app/cache/
composer.lock
vendor/
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ php:
before_script:
- wget http://getcomposer.org/composer.phar
- php composer.phar install


notifications:
email:
- [email protected]

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# PrestaSitemapBundle

[![Build Status](https://secure.travis-ci.org/prestaconcept/PrestaSitemapBundle.png)](http://travis-ci.org/prestaconcept/PrestaSitemapBundle)

## Introduction

What PrestaSitemapBundle can do for you.
Expand Down
35 changes: 35 additions & 0 deletions Tests/app/AppKernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

/*
* This file is part of the prestaSitemapPlugin package.
* (c) David Epely <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// Dependencies
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
//new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
//new JMS\SerializerBundle\JMSSerializerBundle($this),
new Presta\SitemapBundle\PrestaSitemapBundle(),
);

return $bundles;
}

public function registerContainerConfiguration(LoaderInterface $loader)
{
// We dont need that Environment stuff, just one config
$loader->load(__DIR__.'/config.yml');
}
}
12 changes: 12 additions & 0 deletions Tests/app/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
framework:
secret: secret
test: ~
router: { resource: "%kernel.root_dir%/routing.yml" }
form: true
csrf_protection: true
validation: { enable_annotations: true }
session:
storage_id: session.storage.filesystem



3 changes: 3 additions & 0 deletions Tests/app/routing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PrestaSitemapBundle:
resource: "@PrestaSitemapBundle/Resources/config/routing.yml"
prefix: /
26 changes: 26 additions & 0 deletions Tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/*
* This file is part of the prestaSitemapPlugin package.
* (c) David Epely <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

if (file_exists($file = __DIR__ . '/../vendor/autoload.php')) {
require_once $file;
} else {
throw new \RuntimeException('Dependencies are required');
}

spl_autoload_register(function($class) {
if (0 === strpos($class, 'Presta\\SitemapBundle\\PrestaSitemapBundle')) {
$path = __DIR__ . '/../' . implode('/', array_slice(explode('\\', $class), 3)) . '.php';
if (!stream_resolve_include_path($path)) {
return false;
}
require_once $path;
return true;
}
});

26 changes: 26 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="./Tests/bootstrap.php" colors="true">

<php>
<server name="KERNEL_DIR" value="Tests/app" />
</php>

<testsuites>
<testsuite name="PrestaSitemapBundle test suite">
<directory suffix="Test.php">./Tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./Resources</directory>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

0 comments on commit 5486c8c

Please sign in to comment.