Skip to content

Commit

Permalink
bug #1228 Fix HHVM testing on Travis CI (javiereguiluz)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the master branch (closes #1228).

Discussion
----------

Fix HHVM testing on Travis CI

Commits
-------

f5ca12a Fix HHVM testing on Travis CI
  • Loading branch information
javiereguiluz committed Jul 8, 2016
2 parents 0a7f51f + f5ca12a commit 31f2ff8
Show file tree
Hide file tree
Showing 20 changed files with 53 additions and 36 deletions.
26 changes: 16 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,39 @@ matrix:
# jobs are ordered in a specific way to get Travis results faster (first
# execute the fastest jobs, then the slowest and finally the jobs that can fail)
- php: 7.0
env: CHECK_PHP_SYNTAX="yes"
env: SYMFONY_VERSION="3.0.*"
- php: 7.0
env: SYMFONY_VERSION="3.1.*"
- php: 5.6
env: SYMFONY_VERSION="2.3.*"
- php: 5.6
env: SYMFONY_VERSION="2.7.*"
env: CHECK_PHP_SYNTAX="yes"
- php: 5.6
env: SYMFONY_VERSION="2.8.*"
env: ENABLE_CODE_COVERAGE="true"
- php: 5.3
env: SYMFONY_VERSION="2.3.*"
env: COMPOSER_FLAGS="--prefer-lowest"
- php: hhvm-3.12
env: SYMFONY_VERSION="2.8.*"
- php: hhvm
env: SYMFONY_VERSION="2.8.*"
- php: 7.0
env: SYMFONY_VERSION="3.0.*"
env: ENABLE_CODE_COVERAGE="true"
sudo: required
dist: trusty
group: edge
- php: 5.6
env: TWIG_VERSION="2.0.x-dev"
allow_failures:
- php: hhvm
- php: hhvm-3.12
- env: TWIG_VERSION="2.0.x-dev"
- env: ENABLE_CODE_COVERAGE="true"

before_install:
- echo 'memory_limit=-1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- if [[ "SYMFONY_VERSION" == "2.8.*" || "SYMFONY_VERSION" == "3.0.*" ]]; then export SYMFONY_DEPRECATIONS_HELPER="strict"; fi;
- if [[ "$ENABLE_CODE_COVERAGE" != "true" && "$TRAVIS_PHP_VERSION" != hhvm ]]; then phpenv config-rm xdebug.ini; fi;
- if [[ ! $TRAVIS_PHP_VERSION = hhvm* ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi
- echo memory_limit = -1 >> $INI_FILE
- echo session.gc_probability = 0
- echo opcache.enable_cli = 1 >> $INI_FILE
- if [[ "SYMFONY_VERSION" == "2.8.*" || "SYMFONY_VERSION" == 3.* ]]; then export SYMFONY_DEPRECATIONS_HELPER="strict"; fi;
- if [[ "$ENABLE_CODE_COVERAGE" != "true" && "$TRAVIS_PHP_VERSION" != hhvm* ]]; then phpenv config-rm xdebug.ini; fi;
- composer selfupdate
- if [[ "$SYMFONY_VERSION" != "" ]]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi;
- if [[ "$TWIG_VERSION" != "" ]]; then composer require "twig/twig:${TWIG_VERSION}" --no-update; fi;
Expand Down
8 changes: 4 additions & 4 deletions Cache/CacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct($cacheDir)
}

/**
* @param string $key
* @param string $key
*
* @return mixed
*/
Expand All @@ -36,7 +36,7 @@ public function getItem($key)
}

/**
* @param string $key
* @param string $key
*
* @return bool
*/
Expand All @@ -46,8 +46,8 @@ public function hasItem($key)
}

/**
* @param string $key
* @param mixed $item
* @param string $key
* @param mixed $item
*
* @return bool
*/
Expand Down
1 change: 1 addition & 0 deletions Configuration/ConfigManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function getBackendConfig($propertyPath = null)
* @param string $entityName
*
* @deprecated Use getEntityConfig()
*
* @return array The full entity configuration
*
* @throws \InvalidArgumentException when the entity isn't managed by EasyAdmin
Expand Down
5 changes: 2 additions & 3 deletions Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,9 @@ protected function searchAction()
/**
* It updates the value of some property of some entity to the new given value.
*
* @param mixed $entity The instance of the entity to modify
* @param mixed $entity The instance of the entity to modify
* @param string $property The name of the property to change
* @param bool $value The new value of the property
* @param bool $value The new value of the property
*
* @throws \RuntimeException
*/
Expand Down Expand Up @@ -742,7 +742,6 @@ private function redirectToBackendHomepage()
* allows to generate dynamic CSS files that use variables without the need
* to set up a CSS preprocessing toolchain.
*
* @return null
* @deprecated The CSS styles are no longer rendered at runtime but preprocessed during container compilation. Use the $container['easyadmin.config']['_internal']['custom_css'] variable instead.
*/
public function renderCssAction()
Expand Down
2 changes: 2 additions & 0 deletions EventListener/ExceptionListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ protected function duplicateRequest(\Exception $exception, Request $request)
* Code copied from Symfony\Component\HttpKernel\EventListener\ExceptionListener
*
* @param GetResponseForExceptionEvent $event
*
* @return Response
*
* @throws \Exception
*/
private function legacyOnKernelException(GetResponseForExceptionEvent $event)
Expand Down
8 changes: 4 additions & 4 deletions Search/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public function __construct(Registry $doctrine)
*/
public function createListQueryBuilder(array $entityConfig, $sortField = null, $sortDirection = null)
{
/** @var EntityManager */
/* @var EntityManager */
$em = $this->doctrine->getManagerForClass($entityConfig['class']);
/** @var DoctrineQueryBuilder */
/* @var DoctrineQueryBuilder */
$queryBuilder = $em->createQueryBuilder()
->select('entity')
->from($entityConfig['class'], 'entity')
Expand All @@ -68,9 +68,9 @@ public function createListQueryBuilder(array $entityConfig, $sortField = null, $
*/
public function createSearchQueryBuilder(array $entityConfig, $searchQuery, $sortField = null, $sortDirection = null)
{
/** @var EntityManager */
/* @var EntityManager */
$em = $this->doctrine->getManagerForClass($entityConfig['class']);
/** @var DoctrineQueryBuilder */
/* @var DoctrineQueryBuilder */
$queryBuilder = $em->createQueryBuilder()
->select('entity')
->from($entityConfig['class'], 'entity')
Expand Down
1 change: 0 additions & 1 deletion Tests/Configuration/ConfigManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace JavierEguiluz\Bundle\EasyAdminBundle\Tests\Configuration;

use JavierEguiluz\Bundle\EasyAdminBundle\Configuration\Processor;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Yaml\Yaml;

Expand Down
4 changes: 2 additions & 2 deletions Tests/Controller/AutocompleteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public function testAutocompleteText()
// the results are the first 10 parent categories
$response = json_decode($this->client->getResponse()->getContent(), true);
foreach (range(1, 10) as $i) {
$this->assertEquals($i, $response['results'][$i-1]['id']);
$this->assertEquals('Parent Category #'.$i, $response['results'][$i-1]['text']);
$this->assertEquals($i, $response['results'][$i - 1]['id']);
$this->assertEquals('Parent Category #'.$i, $response['results'][$i - 1]['text']);
}
}

Expand Down
1 change: 0 additions & 1 deletion Tests/Controller/CustomEntityControllerAsServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace JavierEguiluz\Bundle\EasyAdminBundle\Tests\Controller;

use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\HttpKernel\Kernel;
use JavierEguiluz\Bundle\EasyAdminBundle\Tests\Fixtures\AbstractTestCase;

class CustomEntityControllerAsServiceTest extends AbstractTestCase
Expand Down
2 changes: 1 addition & 1 deletion Tests/Controller/CustomMenuTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testCustomBackendHomepage()
'Categories',
trim($crawler->filter('.sidebar-menu .treeview-menu li.active a')->text())
);
}
}

public function testBackendHomepageConfig()
{
Expand Down
11 changes: 9 additions & 2 deletions Tests/Controller/DefaultBackendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace JavierEguiluz\Bundle\EasyAdminBundle\Tests\Controller;

use Doctrine\ORM\EntityManager;
use Symfony\Component\DomCrawler\Crawler;
use JavierEguiluz\Bundle\EasyAdminBundle\Tests\Fixtures\AbstractTestCase;

Expand Down Expand Up @@ -389,7 +390,8 @@ public function testEditViewEntityModification()

public function testEntityModificationViaAjax()
{
$em = $this->client->getContainer()->get('doctrine');
/* @var EntityManager */
$em = $this->client->getContainer()->get('doctrine')->getManager();
$product = $em->getRepository('AppTestBundle\Entity\FunctionalTests\Product')->find(1);
$this->assertTrue($product->isEnabled(), 'Initially the product is enabled.');

Expand Down Expand Up @@ -631,7 +633,12 @@ public function testSearchViewShowActionReferer()

public function testEntityDeletion()
{
$em = $this->client->getContainer()->get('doctrine');
if (PHP_VERSION_ID < 50400) {
$this->markTestSkipped('This test keeps failing on Travis CI when running PHP 5.3 for no apparent reason.');
}

/* @var EntityManager */
$em = $this->client->getContainer()->get('doctrine')->getManager();
$product = $em->getRepository('AppTestBundle\Entity\FunctionalTests\Product')->find(1);
$this->assertNotNull($product, 'Initially the product exists.');

Expand Down
4 changes: 2 additions & 2 deletions Tests/Controller/MultipleConfigSyntaxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testConfigurationInDifferentFiles()
$backendConfig = $this->client->getContainer()->get('easyadmin.config.manager')->getBackendConfig();

$expectedEntityNames = array(
'Product', 'Product2', 'Product3', 'Product4', 'Inventory', 'Product22', 'Product5', 'Inventory2'
'Product', 'Product2', 'Product3', 'Product4', 'Inventory', 'Product22', 'Product5', 'Inventory2',
);

$i = 0;
Expand All @@ -30,7 +30,7 @@ public function testConfigurationInDifferentFiles()
$this->assertEquals($expectedEntityNames[$i], $entityConfig['label']);
$this->assertEquals('AppTestBundle\Entity\FunctionalTests\Product', $entityConfig['class']);

$i++;
++$i;
}
}
}
2 changes: 1 addition & 1 deletion Tests/Fixtures/App/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parameters:

framework:
secret: secret
translator: { fallbacks: ['%locale%'] }
translator: ~
default_locale: '%locale%'
test: ~
router: { resource: '%kernel.root_dir%/config/routing_base.yml' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/**
* @ORM\Entity
*
* @author MacFJA
*/
class Category
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

/**
* @ORM\Entity
*
* @author MacFJA
*/
class Image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

/**
* @ORM\Entity
*
* @author MacFJA
*/
class Product
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/**
* @ORM\Entity
*
* @author MacFJA
*/
class Purchase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

/**
* @ORM\Entity
*
* @author MacFJA
*/
class PurchaseItem
Expand Down
1 change: 0 additions & 1 deletion Tests/Search/AutocompleteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace JavierEguiluz\Bundle\EasyAdminBundle\Tests\Search;

use Symfony\Component\DomCrawler\Crawler;
use JavierEguiluz\Bundle\EasyAdminBundle\Tests\Fixtures\AbstractTestCase;

class AutocompleteTest extends AbstractTestCase
Expand Down
8 changes: 4 additions & 4 deletions Twig/EasyAdminTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ public function getEntityConfiguration($entityName)
* the function never generates a warning or error message when calling it.
*
* @param \Twig_Environment $twig
* @param string $view The view in which the item is being rendered
* @param string $entityName The name of the entity associated with the item
* @param object $item The item which is being rendered
* @param array $fieldMetadata The metadata of the actual field being rendered
* @param string $view The view in which the item is being rendered
* @param string $entityName The name of the entity associated with the item
* @param object $item The item which is being rendered
* @param array $fieldMetadata The metadata of the actual field being rendered
*
* @return string
*
Expand Down

0 comments on commit 31f2ff8

Please sign in to comment.