From 5486c8c60806f3496624835e7175d024ca86fb41 Mon Sep 17 00:00:00 2001 From: David Epely Date: Tue, 3 Jul 2012 16:16:01 +0200 Subject: [PATCH] [testing] configure bundle to test it on travis-CI --- .gitignore | 3 +++ .travis.yml | 6 +++++- README.md | 2 ++ Tests/app/AppKernel.php | 35 +++++++++++++++++++++++++++++++++++ Tests/app/config.yml | 12 ++++++++++++ Tests/app/routing.yml | 3 +++ Tests/bootstrap.php | 26 ++++++++++++++++++++++++++ phpunit.xml.dist | 26 ++++++++++++++++++++++++++ 8 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 Tests/app/AppKernel.php create mode 100644 Tests/app/config.yml create mode 100644 Tests/app/routing.yml create mode 100644 Tests/bootstrap.php create mode 100644 phpunit.xml.dist diff --git a/.gitignore b/.gitignore index b25c15b8..cdb625d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ *~ +Tests/app/cache/ +composer.lock +vendor/ diff --git a/.travis.yml b/.travis.yml index 2ed52198..3310816f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,8 @@ php: before_script: - wget http://getcomposer.org/composer.phar - php composer.phar install - \ No newline at end of file + +notifications: + email: + - depely@prestaconcept.net + diff --git a/README.md b/README.md index 97831287..90a4acd1 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/Tests/app/AppKernel.php b/Tests/app/AppKernel.php new file mode 100644 index 00000000..f4b2d4cb --- /dev/null +++ b/Tests/app/AppKernel.php @@ -0,0 +1,35 @@ + + * + * 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'); + } +} diff --git a/Tests/app/config.yml b/Tests/app/config.yml new file mode 100644 index 00000000..a2c2e895 --- /dev/null +++ b/Tests/app/config.yml @@ -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 + + + diff --git a/Tests/app/routing.yml b/Tests/app/routing.yml new file mode 100644 index 00000000..efa3a24f --- /dev/null +++ b/Tests/app/routing.yml @@ -0,0 +1,3 @@ +PrestaSitemapBundle: + resource: "@PrestaSitemapBundle/Resources/config/routing.yml" + prefix: / diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php new file mode 100644 index 00000000..e2ead110 --- /dev/null +++ b/Tests/bootstrap.php @@ -0,0 +1,26 @@ + + * + * 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; + } +}); + diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 00000000..f725e2fa --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,26 @@ + + + + + + + + + + + ./Tests + + + + + + ./ + + ./Resources + ./Tests + ./vendor + + + + +