Skip to content
Permalink
Browse files

Updated Travis testing matrix (#145)

* Updated Travis testing matrix

* Fixing Travis build

* Fixing Travis build

* Fixed risky tests

* Removed HHVM in favor of PHP 7.1

* Removed unecessary bundles in test app

* Adde security config to test app to avoid deprecations

* Do not get router.request_context service directly to avoid deprecations

* Fixed PhpUnit and Symfony4 deprecations
  • Loading branch information...
yann-eugone committed Aug 7, 2017
1 parent f6520b7 commit e797d33b8f69f7b40f17d2023bb38e12aab362a6
@@ -1,5 +1,6 @@
*~
Tests/app/cache/
composer.lock
phpunit.xml
vendor/
Tests/web
@@ -3,7 +3,7 @@ language: php
php:
- 5.6
- 7.0
- hhvm
- 7.1

matrix:
include:
@@ -15,12 +15,14 @@ matrix:
env: SYMFONY_VERSION=2.8.* SYMFONY_DEPRECATIONS_HELPER=strict
- php: 5.6
env: SYMFONY_VERSION=3.0.* SYMFONY_DEPRECATIONS_HELPER=strict
- php: 5.6
env: SYMFONY_VERSION=3.2.*@dev SYMFONY_DEPRECATIONS_HELPER=strict
- php: 7.0
env: PHPCS=yes
env: SYMFONY_VERSION=3.2.* SYMFONY_DEPRECATIONS_HELPER=strict
- php: 7.1
env: SYMFONY_VERSION=3.3.* SYMFONY_DEPRECATIONS_HELPER=strict
- php: 7.1
env: SYMFONY_VERSION=3.4.*@dev SYMFONY_DEPRECATIONS_HELPER=strict
allow_failures:
- env: SYMFONY_VERSION=3.2.*@dev
- env: SYMFONY_VERSION=3.4.*@dev

env:
global:
@@ -36,7 +38,8 @@ before_install:
- if [ "$PHPCS" = "yes" ]; then pear install pear/PHP_CodeSniffer; fi
- if [ "$PHPCS" = "yes" ]; then phpenv rehash; fi
- if [ "$PHPCS" != "yes"]; then composer selfupdate; fi
- if [ "$SYMFONY_VERSION" = "3.2.*@dev" ]; then composer require --no-update twig/twig:~2.0@dev; fi
- if [ "$SYMFONY_VERSION" = "3.4.*@dev" ]; then rm -f phpunit.xml; cp phpunit.sf4.xml.dist phpunit.xml; fi
- if [ "$SYMFONY_VERSION" = "3.2.*" ] || [ "$SYMFONY_VERSION" = "3.3.*" ] || [ "$SYMFONY_VERSION" = "3.4.*@dev" ]; then composer require --no-update twig/twig:~2.0; fi
- if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update symfony/symfony:${SYMFONY_VERSION}; fi

install: if [ "$PHPCS" != "yes" ]; then composer update --prefer-dist; fi
@@ -128,7 +128,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
*/
private function getBaseUrl()
{
$context = $this->getContainer()->get('router.request_context');
$context = $this->getContainer()->get('router')->getContext();
if ('' === $host = $context->getHost()) {
throw new \RuntimeException(
@@ -16,9 +16,20 @@
use Presta\SitemapBundle\Service\Generator;
use Presta\SitemapBundle\Sitemap\Url;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\DependencyInjection\ContainerInterface;
class SitemapControllerTest extends WebTestCase
{
/**
* @var Controller\SitemapController
*/
private $controller;
/**
* @var ContainerInterface
*/
private $container;
public function setUp()
{
//boot appKernel
@@ -51,23 +62,21 @@ function (SitemapPopulateEvent $event) {
public function testIndexAction()
{
$response = $this->controller->indexAction();
$this->isInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
$response = $this->controller->indexAction();
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
}
public function testValidSectionAction()
{
$response = $this->controller->sectionAction('default');
$this->isInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
}
/**
* @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/
public function testNotFoundSectionAction()
{
try {
$this->controller->sectionAction('void');
$this->fail('section "void" does\'nt exist');
} catch (\Symfony\Component\HttpKernel\Exception\NotFoundHttpException $e) {
//this is ok
}
$this->controller->sectionAction('void');
}
}
@@ -34,6 +34,7 @@ public function testGenerate()
{
try {
$this->generator->generate();
$this->assertTrue(true, 'No exception was thrown');
} catch (\RuntimeException $e) {
$this->fail('No exception must be thrown');
}
@@ -49,6 +50,7 @@ public function testAddUrl()
{
try {
$this->generator->addUrl(new Sitemap\Url\UrlConcrete('http://acme.com/'), 'default');
$this->assertTrue(true, 'No exception was thrown');
} catch (\RuntimeException $e) {
$this->fail('No exception must be thrown');
}
@@ -20,8 +20,6 @@ public function registerBundles()
// 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(),
);
@@ -7,3 +7,14 @@ framework:
validation: { enable_annotations: true }
session:
storage_id: session.storage.filesystem

security:
providers:
in_memory:
memory: ~
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: ~
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url>
<loc>http://sitemap.php54.local/page_video1/</loc>
<video:video>
<video:thumbnail_loc>http://sitemap.php54.local/page_video1/thumbnail_loc?a=b&amp;b=c</video:thumbnail_loc>
<video:title><![CDATA[Title & spécial chars]]></video:title>
<video:description><![CDATA[The description & spécial chars]]></video:description>
<video:content_loc>http://sitemap.php54.local/page_video1/content?format=mov&amp;a=b</video:content_loc>
<video:gallery_loc title="Gallery title &amp; spécial chars">http://sitemap.php54.local/page_video1/gallery_loc/?p=1&amp;sort=desc</video:gallery_loc>
</video:video>
</url>
<url>
<loc>http://sitemap.php54.local/page_video1/</loc>
<video:video>
<video:thumbnail_loc>http://sitemap.php54.local/page_video1/thumbnail_loc?a=b&amp;b=c</video:thumbnail_loc>
<video:title><![CDATA[Title & spécial chars]]></video:title>
<video:description><![CDATA[The description & spécial chars]]></video:description>
<video:content_loc>http://sitemap.php54.local/page_video1/content?format=mov&amp;a=b</video:content_loc>
<video:gallery_loc title="Gallery title &amp; spécial chars">http://sitemap.php54.local/page_video1/gallery_loc/?p=1&amp;sort=desc</video:gallery_loc>
</video:video>
</url>
</urlset>
@@ -24,7 +24,8 @@
"symfony/symfony": "~2.2|~3.0"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7|~3.0"
"symfony/phpunit-bridge": "~2.7|~3.0",
"phpunit/phpunit": "4.*"
},
"suggest": {
"doctrine/doctrine-cache-bundle" : "Allows to store sitemaps in cache"
@@ -34,6 +35,11 @@
"Presta\\SitemapBundle\\": ""
}
},
"autoload-dev": {
"files": [
"Tests/app/AppKernel.php"
]
},
"extra": {
"branch-alias": {
"dev-master": "1.5.x-dev"
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./Tests/bootstrap.php" colors="true">
<php>
<server name="KERNEL_CLASS" value="AppKernel" />
</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 e797d33

Please sign in to comment.
You can’t perform that action at this time.