Skip to content

Commit

Permalink
Debug travis
Browse files Browse the repository at this point in the history
  • Loading branch information
julienbourdeau committed Aug 24, 2018
1 parent 449f3f8 commit c992e71
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 11 deletions.
6 changes: 4 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="vendor/autoload.php">
<phpunit colors="true" bootstrap="vendor/autoload.php" convertDeprecationsToExceptions="false">
<php>
<env name="KERNEL_CLASS" value="Algolia\SearchBundle\Kernel" />
<env name="APP_ENV" value="test" />
<env name="APP_DEBUG" value="false" />
<env name="ALGOLIA_PREFIX" value="TRAVIS_sf_" />
<env name="ALGOLIA_PREFIX" value="sf_phpunit_" />
<env name="TRAVIS_JOB_NUMBER" value="" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled" />
</php>
<testsuites>
<testsuite name="TestCase">
Expand Down
36 changes: 28 additions & 8 deletions tests/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,39 @@

namespace Algolia\SearchBundle;

use Algolia\SearchBundle\Doctrine\NullConnection;
use Algolia\SearchBundle\Engine\AlgoliaEngine;
use Algolia\SearchBundle\Engine\AlgoliaSyncEngine;
use Algolia\SearchBundle\Engine\NullEngine;
use Algolia\SearchBundle\Entity\Comment;
use AlgoliaSearch\Client;
use Algolia\SearchBundle\Entity\Post;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\Yaml\Yaml;

class BaseTest extends KernelTestCase
{
public static function setUpBeforeClass()
{
/*
* Older version of PHPUnit (<6.0) load
* env variables differently, we override them
* here to make sure they're coming from the
* env rather than the XML config
*/
if (class_exists('\PHPUnit_Runner_Version')) {
$_ENV['ALGOLIA_PREFIX'] = getenv('ALGOLIA_PREFIX');
$_ENV['TRAVIS_JOB_NUMBER'] = getenv('TRAVIS_JOB_NUMBER');
}

/*
* Doctrine is currently splitting the common package
* into 3 separate ones, some deprecation notice appeared
* until we can migrate doctrine/common and keep BC
* with PHP 5.6 and Symfony 3.4, we allow deprecation
* notice in PHPUnit
*
* https://github.com/doctrine/common/issues/826
*/
// if (class_exists('\PHPUnit\Framework\Error\Deprecated')) {
// \PHPUnit\Framework\Error\Deprecated::$enabled = false;
// }
}

public function setUp()
{
$this->bootKernel();
Expand Down Expand Up @@ -60,7 +80,7 @@ protected function createComment($id = null)

protected function getPrefix()
{
return getenv('ALGOLIA_PREFIX');
return $this->get('search.index_manager')->getConfiguration()['prefix'];
}

protected function get($id)
Expand Down
2 changes: 1 addition & 1 deletion tests/config/algolia_search.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
algolia_search:
prefix: '%env(ALGOLIA_PREFIX)%'
prefix: '%env(ALGOLIA_PREFIX)%%env(TRAVIS_JOB_NUMBER)%_'
nbResults: 12
batchSize: 100
settingsDirectory: '/tests/cache/settings'
Expand Down

0 comments on commit c992e71

Please sign in to comment.