Skip to content

Commit

Permalink
Merge pull request #26 from DmytryHo/hotfix/add-support-of-dataloader…
Browse files Browse the repository at this point in the history
…-0-6

Add overblog/dataloader-php 0.6
  • Loading branch information
mcg-web committed Jan 23, 2021
2 parents f2e88d2 + 191533d commit 505ed3c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
@@ -1,6 +1,6 @@
language: php

dist: trusty
dist: bionic
sudo: false

git:
Expand All @@ -15,7 +15,7 @@ matrix:
fast_finish: true
include:
- php: 7.2
env: SYMFONY_VERSION=4.1.* TEST_COVERAGE=true
env: SYMFONY_VERSION=4.1.* PHPUNIT_VERSION=6.5.* TEST_COVERAGE=true
- php: 7.3
env: SYMFONY_VERSION=4.2.*
- php: 7.3
Expand All @@ -24,6 +24,8 @@ matrix:
env: SYMFONY_VERSION=4.4.* SYMFONY_DEPRECATIONS_HELPER=max[total]=0
- php: 7.4snapshot
env: SYMFONY_VERSION=5.0.* SYMFONY_DEPRECATIONS_HELPER=max[total]=0
- php: 8.0
env: SYMFONY_VERSION=5.0.* SYMFONY_DEPRECATIONS_HELPER=max[total]=36
- php: nightly
env: COMPOSER_UPDATE_FLAGS=--ignore-platform-reqs
allow_failures:
Expand All @@ -38,6 +40,7 @@ before_install:
- if [[ "${TEST_COVERAGE}" != "true" ]]; then phpenv config-rm xdebug.ini || true; fi
- composer selfupdate
- if [ "${SYMFONY_VERSION}" != "" ]; then perl -pi -e 's#"(symfony/.*)":\s*".*"#"$1":"'"${SYMFONY_VERSION}"'"#' composer.json; fi;
- if [ "${PHPUNIT_VERSION}" != "" ]; then perl -pi -e 's#"(phpunit/.*)":\s*".*"#"$1":"'"${PHPUNIT_VERSION}"'"#' composer.json; fi;
# disable default memory limit
- export INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- echo memory_limit = -1 >> $INI
Expand Down
12 changes: 6 additions & 6 deletions Tests/DependencyInjection/OverblogDataLoaderExtensionTest.php
Expand Up @@ -14,6 +14,7 @@
use Overblog\DataLoaderBundle\DependencyInjection\Configuration;
use Overblog\DataLoaderBundle\DependencyInjection\OverblogDataLoaderExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
Expand All @@ -29,15 +30,15 @@ class OverblogDataLoaderExtensionTest extends TestCase
*/
private $extension;

public function setUp()
public function setUp(): void
{
$this->container = new ContainerBuilder();
$this->container->setParameter('kernel.bundles', []);
$this->container->setParameter('kernel.debug', false);
$this->extension = new OverblogDataLoaderExtension();
}

public function tearDown()
public function tearDown(): void
{
unset($this->container, $this->extension);
}
Expand Down Expand Up @@ -148,12 +149,11 @@ public function testImagesDataLoaderConfig()
);
}

/**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
* @expectedExceptionMessage Invalid configuration for path "overblog_dataloader.loaders.users.batch_load_fn": "this is not a callable" doesn't seem to be a valid callable.
*/
public function testBatchLoadFnNotCallable()
{
$this->expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage('Invalid configuration for path "overblog_dataloader.loaders.users.batch_load_fn": "this is not a callable" doesn\'t seem to be a valid callable.');

$this->extension->load(
[
[
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/TestCase.php
Expand Up @@ -45,7 +45,7 @@ protected static function createKernel(array $options = [])
/**
* {@inheritdoc}
*/
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
$fs = new Filesystem();
$fs->remove(sys_get_temp_dir().'/OverblogDataLoaderBundle/');
Expand Down
5 changes: 3 additions & 2 deletions Tests/Functional/UserLoaderTest.php
Expand Up @@ -13,10 +13,11 @@

use Overblog\DataLoader\DataLoader;
use Overblog\DataLoaderBundle\Tests\Functional\app\UserDataProvider;
use function React\Promise\all;

class UserLoaderTest extends TestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();

Expand All @@ -29,7 +30,7 @@ public function testGetUsers()
/** @var DataLoader $userLoader */
$userLoader = static::$kernel->getContainer()->get('users_loader');

$promise = \React\Promise\all([
$promise = all([
$userLoader->load(3),
$userLoader->load(5),
$userLoader->loadMany([5, 2, 4]),
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -24,11 +24,11 @@
},
"require": {
"php": ">=7.2",
"overblog/dataloader-php": "^0.5.0",
"overblog/dataloader-php": "^0.5.0 || ^0.6.0",
"symfony/dependency-injection": "^4.3 || ^5.0"
},
"require-dev": {
"phpunit/phpunit": "^4.1 || ^5.5 || ^6.0",
"phpunit/phpunit": "^4.1 || ^5.5 || ^6.5 || ^7.5 || ^8.5",
"react/promise": "^2.5",
"symfony/dependency-injection": "^4.3 || ^5.0",
"symfony/framework-bundle": "^4.3 || ^5.0",
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml.dist
Expand Up @@ -8,7 +8,6 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php"
>
<testsuites>
Expand Down

0 comments on commit 505ed3c

Please sign in to comment.