Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
Merge 44e2fe6 into ee86599
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI committed Jan 31, 2020
2 parents ee86599 + 44e2fe6 commit 9b7004d
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 43 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# https://github.com/actions/stale

name: "Stale"

on:
schedule:
- cron: "0 9-18 * * *"

jobs:
stale:
runs-on: "ubuntu-latest"

steps:
- name: "Close stale issues and pull requests"
uses: "actions/stale@v1.1.0"
with:
days-before-close: 7
days-before-stale: 180
repo-token: "${{ secrets.GITHUB_TOKEN }}"
exempt-issue-label: "keep"
stale-issue-label: "pending author"
stale-issue-message: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
stale-pr-label: "pending author"
stale-pr-message: >
This PR has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ env:
- SYMFONY_DEPRECATIONS_HELPER=max[self]=0
- TARGET=test
- UPSTREAM_URL=https://github.com/sonata-project/SonataAdminSearchBundle.git
- PHPUNIT_VERSION=7
- PHPUNIT_VERSION=8

matrix:
fast_finish: true
Expand All @@ -45,9 +45,9 @@ matrix:
- php: '7.2'
env: COMPOSER_FLAGS="--prefer-lowest"
- php: '7.3'
env: SYMFONY=3.4.*
env: SYMFONY=4.4.*
- php: '7.3'
env: SYMFONY='dev-master as 3.4.x-dev'
env: SYMFONY='dev-master as 4.4.x-dev'
- php: '7.3'
env: SONATA_ADMIN=3.*
- php: '7.3'
Expand All @@ -62,7 +62,7 @@ matrix:
- php: 7.4snapshot
- php: nightly
- env: SYMFONY_DEPRECATIONS_HELPER=0
- env: SYMFONY='dev-master as 3.4.x-dev'
- env: SYMFONY='dev-master as 4.4.x-dev'
- env: SONATA_ADMIN='dev-master as 3.x-dev'
- env: RUFLIN_ELASTICA='dev-master as 2.x-dev'

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
},
"require-dev": {
"matthiasnoback/symfony-config-test": "^4.0",
"matthiasnoback/symfony-dependency-injection-test": "^3.1",
"symfony/phpunit-bridge": "^4.2"
"matthiasnoback/symfony-dependency-injection-test": "^4.1",
"symfony/phpunit-bridge": "^5.0"
},
"config": {
"sort-packages": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
namespace Sonata\AdminSearchBundle\Tests\DependencyInjection\Compiler;

use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractCompilerPassTestCase;
use Sonata\AdminSearchBundle\Builder\DatagridBuilder;
use Sonata\AdminSearchBundle\DependencyInjection\Compiler\DatagridBuilderInjectionCompilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

class DatagridBuilderInjectionCompilerPassTest extends AbstractCompilerPassTestCase
{
public function testDatagridBuilderIsInjected()
public function testDatagridBuilderIsInjected(): void
{
$this->setParameter(
'sonata.admin.search.admin_finder_services',
Expand All @@ -32,7 +33,7 @@ public function testDatagridBuilderIsInjected()
$this->setDefinition(
'sonata.admin.search.datagrid_builder',
new Definition(
'Sonata\AdminSearchBundle\Builder\DatagridBuilder',
DatagridBuilder::class,
[
new Reference('sonata.admin.search.elastica_datagrid_builder'),
null,
Expand All @@ -47,7 +48,7 @@ public function testDatagridBuilderIsInjected()
);
}

protected function registerCompilerPass(ContainerBuilder $container)
protected function registerCompilerPass(ContainerBuilder $container): void
{
$container->addCompilerPass(new DatagridBuilderInjectionCompilerPass());
}
Expand Down
9 changes: 5 additions & 4 deletions tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
namespace Sonata\AdminSearchBundle\Tests\DependencyInjection;

use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
use PHPUnit\Framework\TestCase;
use Sonata\AdminSearchBundle\DependencyInjection\Configuration;

class ConfigurationTest
class ConfigurationTest extends TestCase
{
use ConfigurationTestCaseTrait;

public function testValidation()
public function testValidation(): void
{
$this->assertConfigurationIsInvalid(
[
Expand All @@ -33,7 +34,7 @@ public function testValidation()
);
}

public function testProcessing()
public function testProcessing(): void
{
$this->assertProcessedConfigurationEquals(
[
Expand All @@ -53,7 +54,7 @@ public function testProcessing()
);
}

protected function getConfiguration()
protected function getConfiguration(): Configuration
{
return new Configuration();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/DependencyInjection/SonataAdminSearchExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

class SonataAdminSearchExtensionTest extends AbstractExtensionTestCase
{
public function getContainerExtensions()
public function getContainerExtensions(): array
{
return [
new SonataAdminSearchExtension(),
];
}

public function testLoad()
public function testLoad(): void
{
$this->load([
'admin_finder_services' => $expectedParameterValue = [
Expand Down
11 changes: 5 additions & 6 deletions tests/Filter/BooleanFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Sonata\AdminSearchBundle\Tests\Filter;

use FOS\ElasticaBundle\Finder\TransformedFinder;
use PHPUnit\Framework\TestCase;
use Sonata\AdminSearchBundle\Filter\BooleanFilter;
use Sonata\AdminSearchBundle\ProxyQuery\ElasticaProxyQuery;
Expand All @@ -25,16 +26,14 @@ class BooleanFilterTest extends TestCase
*/
protected $proxyQuery;

public function setup()
protected function setUp(): void
{
$finder = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
$finder = $this->createMock(TransformedFinder::class);

$this->proxyQuery = new ElasticaProxyQuery($finder);
}

public function testNoFilterSimple()
public function testNoFilterSimple(): void
{
$filter = new BooleanFilter();
$value = BooleanType::TYPE_NO;
Expand All @@ -51,7 +50,7 @@ public function testNoFilterSimple()
$this->assertSame('false', $queryArray['query']['bool']['must'][0]['term']['foo']);
}

public function testYesFilterSimple()
public function testYesFilterSimple(): void
{
$filter = new BooleanFilter();
$value = BooleanType::TYPE_YES;
Expand Down
2 changes: 1 addition & 1 deletion tests/Filter/DateFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
class DateFilterTest extends TestCase
{
public function testGetFilterTypeClass()
public function testGetFilterTypeClass(): void
{
$filter = new DateFilter();

Expand Down
2 changes: 1 addition & 1 deletion tests/Filter/DateRangeFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
class DateRangeFilterTest extends TestCase
{
public function testGetFilterTypeClass()
public function testGetFilterTypeClass(): void
{
$filter = new DateRangeFilter();

Expand Down
2 changes: 1 addition & 1 deletion tests/Filter/DateTimeFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
class DateTimeFilterTest extends TestCase
{
public function testGetFilterTypeClass()
public function testGetFilterTypeClass(): void
{
$filter = new DateTimeFilter();

Expand Down
2 changes: 1 addition & 1 deletion tests/Filter/DateTimeRangeFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
class DateTimeRangeFilterTest extends TestCase
{
public function testGetFilterTypeClass()
public function testGetFilterTypeClass(): void
{
$filter = new DateTimeRangeFilter();

Expand Down
11 changes: 5 additions & 6 deletions tests/Filter/StringFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Sonata\AdminSearchBundle\Tests\Filter;

use FOS\ElasticaBundle\Finder\TransformedFinder;
use PHPUnit\Framework\TestCase;
use Sonata\AdminSearchBundle\Filter\StringFilter;
use Sonata\AdminSearchBundle\ProxyQuery\ElasticaProxyQuery;
Expand All @@ -24,16 +25,14 @@ class StringFilterTest extends TestCase
*/
protected $proxyQuery;

public function setup()
protected function setUp(): void
{
$finder = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
$finder = $this->createMock(TransformedFinder::class);

$this->proxyQuery = new ElasticaProxyQuery($finder);
}

public function testFilterSimple()
public function testFilterSimple(): void
{
$filter = new StringFilter();
$value = 'bar';
Expand All @@ -53,7 +52,7 @@ public function testFilterSimple()
/**
* Check if filter query with special characters can be translated into JSON.
*/
public function testFilterSpecialCharacters()
public function testFilterSpecialCharacters(): void
{
$filter = new StringFilter();
$value = 'bar \ + - && || ! ( ) { } [ ] ^ " ~ * ? : baz';
Expand Down
8 changes: 5 additions & 3 deletions tests/Model/FinderProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
namespace Sonata\AdminSearchBundle\Tests\Model;

use PHPUnit\Framework\TestCase;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\AdminSearchBundle\Model\FinderProvider;
use Symfony\Component\DependencyInjection\ContainerInterface;

class FinderProviderTest extends TestCase
{
public function testGetFinderByAdmin()
public function testGetFinderByAdmin(): void
{
$admin = $this->createMock('Sonata\AdminBundle\Admin\AdminInterface');
$container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface');
$admin = $this->createMock(AdminInterface::class);
$container = $this->createMock(ContainerInterface::class);
$provider = new FinderProvider(
$container,
[
Expand Down
17 changes: 8 additions & 9 deletions tests/ProxyQuery/ElasticaProxyQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
namespace Sonata\AdminSearchBundle\Tests\ProxyQuery;

use FOS\ElasticaBundle\Finder\TransformedFinder;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Sonata\AdminSearchBundle\ProxyQuery\ElasticaProxyQuery;

class ElasticaProxyQueryTest extends TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|TransformedFinder
* @var MockObject|TransformedFinder
*/
protected $finder;

Expand All @@ -35,23 +36,21 @@ class ElasticaProxyQueryTest extends TestCase
'columnName' => 'name',
];

public function setup()
protected function setUp(): void
{
$this->finder = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
$this->finder = $this->createMock(TransformedFinder::class);

$this->proxyQuery = new ElasticaProxyQuery($this->finder);
}

public function testSortByNoParent()
public function testSortByNoParent(): void
{
$this->proxyQuery->setSortBy(null, $this->fieldMapping);

$this->assertSame('name', $this->proxyQuery->getSortBy());
}

public function testSortByWithParent()
public function testSortByWithParent(): void
{
$parentMapping = [
[
Expand All @@ -64,7 +63,7 @@ public function testSortByWithParent()
$this->assertSame('category.name', $this->proxyQuery->getSortBy());
}

public function testSortOrder()
public function testSortOrder(): void
{
$this->proxyQuery->setSortOrder('ASC');

Expand All @@ -74,7 +73,7 @@ public function testSortOrder()
/**
* Test if "setSort" method of Elastica query has been called.
*/
public function testExecuteWithSort()
public function testExecuteWithSort(): void
{
$this->finder->expects($this->once())
->method('createPaginatorAdapter');
Expand Down

0 comments on commit 9b7004d

Please sign in to comment.