Skip to content

Commit

Permalink
Merge pull request #7 from lmc-eu/feature/update-dependencies
Browse files Browse the repository at this point in the history
Drop support for php 8.1 and uUpdate dependencies
  • Loading branch information
MortalFlesh authored Mar 6, 2024
2 parents 6b133b7 + de66ad7 commit 57ba414
Show file tree
Hide file tree
Showing 26 changed files with 106 additions and 145 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:

strategy:
matrix:
php-version: ['8.1']
php-version: ['8.2', '8.3']
dependencies: ['']
include:
- { php-version: '8.1', dependencies: '--prefer-lowest --prefer-stable' }
- { php-version: '8.2', dependencies: '--prefer-lowest --prefer-stable' }

name: Unit tests - PHP ${{ matrix.dependencies }}

Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
extensions: json, mbstring

- name: Install dependencies
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<!-- There should always be "Unreleased" section at the beginning. -->

## Unreleased
- Drop support for php 8.1
- Update dependencies

## 3.0.0 - 2022-04-27
- Require php 8.1
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"license": "MIT",
"type": "library",
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-json": "*",
"ext-mbstring": "*",
"lmc/cqrs-types": "^3.0",
"lmc/cqrs-types": "^3.2",
"nelmio/solarium-bundle": "^5.0",
"solarium/solarium": "^6.2.3"
},
Expand All @@ -18,7 +18,7 @@
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5.20"
"phpunit/phpunit": "^11.0.4"
},
"autoload": {
"psr-4": {
Expand All @@ -32,9 +32,9 @@
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"ergebnis/composer-normalize": true,
"phpstan/extension-installer": true,
"dealerdirect/phpcodesniffer-composer-installer": true
"phpstan/extension-installer": true
},
"sort-packages": true
},
Expand Down
19 changes: 7 additions & 12 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
bootstrap="vendor/autoload.php"
>

xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd" colors="true"
bootstrap="vendor/autoload.php">
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
<report>
<clover outputFile="./reports/clover.xml"/>
<html outputDirectory="./reports" highLowerBound="90"/>
</report>
</coverage>

<php>
<!-- E_ALL = 30719 -->
<ini name="error_reporting" value="30719"/>
</php>

<testsuites>
<testsuite name="unit">
<directory>tests/</directory>
</testsuite>
</testsuites>

<logging>
<junit outputFile="./reports/junit.xml"/>
</logging>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
3 changes: 2 additions & 1 deletion tests/AbstractSolrTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Lmc\Cqrs\Solr;

use PHPUnit\Framework\Attributes\Before;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\EventDispatcher\EventDispatcherInterface;
Expand All @@ -15,7 +16,7 @@ abstract class AbstractSolrTestCase extends TestCase
/** @var Client|MockObject */
protected Client $client;

/** @before */
#[Before]
protected function setUpClient(): void
{
$this->client = $this->createMock(Client::class);
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixture/FulltextApplicatorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

trait FulltextApplicatorTrait
{
public function provideGlobalEdismax(): array
public static function provideGlobalEdismax(): array
{
return [
// isGlobal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Lmc\Cqrs\Solr\QueryBuilder\EntityInterface\EntityInterface;
use Lmc\Cqrs\Solr\QueryBuilder\Query\BuilderPrototypeQuery;

class ApplicatorTestCase extends AbstractSolrTestCase
abstract class AbstractApplicatorTestCase extends AbstractSolrTestCase
{
protected function getApplicator(string $applicatorClass, EntityInterface $entity): ApplicatorInterface
{
Expand Down
10 changes: 5 additions & 5 deletions tests/QueryBuilder/Applicator/ApplicatorFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
use Lmc\Cqrs\Solr\QueryBuilder\Fixture\ParameterizedDummyEntity;
use Lmc\Cqrs\Solr\QueryBuilder\Fixture\SortDummyEntity;
use Lmc\Cqrs\Solr\QueryBuilder\Fixture\StatsDummyEntity;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

class ApplicatorFactoryTest extends TestCase
Expand Down Expand Up @@ -67,11 +69,9 @@ protected function setUp(): void

/**
* @param string[] $expected
*
* @dataProvider provideEntities
*
* @test
*/
#[Test]
#[DataProvider('provideEntities')]
public function shouldGetFixturesForEntity(EntityInterface $entity, array $expected): void
{
$applicators = $this->applicatorFactory->getApplicators($entity);
Expand All @@ -85,7 +85,7 @@ public function shouldGetFixturesForEntity(EntityInterface $entity, array $expec
}
}

public function provideEntities(): array
public static function provideEntities(): array
{
return [
[
Expand Down
11 changes: 4 additions & 7 deletions tests/QueryBuilder/Applicator/EntityApplicatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Lmc\Cqrs\Solr\QueryBuilder\Applicator;

use Lmc\Cqrs\Solr\QueryBuilder\Fixture\BaseDummyEntity;
use PHPUnit\Framework\Attributes\Test;

class EntityApplicatorTest extends ApplicatorTestCase
class EntityApplicatorTest extends AbstractApplicatorTestCase
{
private EntityApplicator $entityApplicator;

Expand All @@ -13,9 +14,7 @@ protected function setUp(): void
$this->entityApplicator = new EntityApplicator();
}

/**
* @test
*/
#[Test]
public function shouldApplyEntityInterface(): void
{
$baseEntity = new BaseDummyEntity();
Expand All @@ -28,9 +27,7 @@ public function shouldApplyEntityInterface(): void
$this->assertStringContainsString('fl=' . implode(',', $baseEntity->getFields()), $queryUri);
}

/**
* @test
*/
#[Test]
public function shouldUsePlaceholderForAllFields(): void
{
$baseEntity = new BaseDummyEntity('', []);
Expand Down
7 changes: 3 additions & 4 deletions tests/QueryBuilder/Applicator/FacetsApplicatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Lmc\Cqrs\Solr\QueryBuilder\Applicator;

use Lmc\Cqrs\Solr\QueryBuilder\Fixture\FacetsDummyEntity;
use PHPUnit\Framework\Attributes\Test;

class FacetsApplicatorTest extends ApplicatorTestCase
class FacetsApplicatorTest extends AbstractApplicatorTestCase
{
private FacetsApplicator $facetsApplicator;

Expand All @@ -13,9 +14,7 @@ protected function setUp(): void
$this->facetsApplicator = new FacetsApplicator();
}

/**
* @test
*/
#[Test]
public function shouldApplyFacetsOnQuery(): void
{
$entity = new FacetsDummyEntity();
Expand Down
7 changes: 3 additions & 4 deletions tests/QueryBuilder/Applicator/FilterApplicatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Lmc\Cqrs\Solr\QueryBuilder\Applicator;

use Lmc\Cqrs\Solr\QueryBuilder\Fixture\FilterDummyEntity;
use PHPUnit\Framework\Attributes\Test;

class FilterApplicatorTest extends ApplicatorTestCase
class FilterApplicatorTest extends AbstractApplicatorTestCase
{
private FilterApplicator $filterApplicator;

Expand All @@ -13,9 +14,7 @@ protected function setUp(): void
$this->filterApplicator = new FilterApplicator();
}

/**
* @test
*/
#[Test]
public function shouldApplyFilterApplicatorOnQuery(): void
{
$entity = new FilterDummyEntity();
Expand Down
7 changes: 3 additions & 4 deletions tests/QueryBuilder/Applicator/FiltersApplicatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Lmc\Cqrs\Solr\QueryBuilder\Applicator;

use Lmc\Cqrs\Solr\QueryBuilder\Fixture\FiltersDummyEntity;
use PHPUnit\Framework\Attributes\Test;

class FiltersApplicatorTest extends ApplicatorTestCase
class FiltersApplicatorTest extends AbstractApplicatorTestCase
{
private FiltersApplicator $filtersApplicator;

Expand All @@ -13,9 +14,7 @@ protected function setUp(): void
$this->filtersApplicator = new FiltersApplicator();
}

/**
* @test
*/
#[Test]
public function shouldApplyFilterApplicatorOnQuery(): void
{
$entity = new FiltersDummyEntity();
Expand Down
16 changes: 7 additions & 9 deletions tests/QueryBuilder/Applicator/FulltextApplicatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
use Lmc\Cqrs\Solr\Fixture\FulltextApplicatorTrait;
use Lmc\Cqrs\Solr\QueryBuilder\Fixture\DisabledEDisMaxDummyEntity;
use Lmc\Cqrs\Solr\QueryBuilder\Fixture\FulltextDummyEntity;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;

class FulltextApplicatorTest extends ApplicatorTestCase
class FulltextApplicatorTest extends AbstractApplicatorTestCase
{
use FulltextApplicatorTrait;

Expand All @@ -17,10 +19,8 @@ protected function setUp(): void
$this->fulltextApplicator = new FulltextApplicator();
}

/**
* @test
* @dataProvider provideGlobalEdismax
*/
#[Test]
#[DataProvider('provideGlobalEdismax')]
public function shouldApplyFulltextOnQuery(bool $isGlobalEdismax): void
{
$entity = new FulltextDummyEntity($isGlobalEdismax);
Expand All @@ -35,10 +35,8 @@ public function shouldApplyFulltextOnQuery(bool $isGlobalEdismax): void
$this->assertApplyFulltextOnQuery($entity, $queryUri);
}

/**
* @test
* @dataProvider provideGlobalEdismax
*/
#[Test]
#[DataProvider('provideGlobalEdismax')]
public function shouldApplyFulltextOnQueryWithDisabledEDisMax(bool $isGlobalEdismax): void
{
$entity = new DisabledEDisMaxDummyEntity($isGlobalEdismax);
Expand Down
16 changes: 7 additions & 9 deletions tests/QueryBuilder/Applicator/FulltextBigramApplicatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

use Lmc\Cqrs\Solr\Fixture\FulltextApplicatorTrait;
use Lmc\Cqrs\Solr\QueryBuilder\Fixture\FulltextBigramDummyEntity;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;

class FulltextBigramApplicatorTest extends ApplicatorTestCase
class FulltextBigramApplicatorTest extends AbstractApplicatorTestCase
{
use FulltextApplicatorTrait;

Expand All @@ -16,10 +18,8 @@ protected function setUp(): void
$this->fulltextBigramApplicator = new FulltextBigramApplicator();
}

/**
* @test
* @dataProvider provideGlobalEdismax
*/
#[Test]
#[DataProvider('provideGlobalEdismax')]
public function shouldApplyFulltextOnQuery(bool $isGlobalEdismax): void
{
$entity = new FulltextBigramDummyEntity(true, $isGlobalEdismax);
Expand Down Expand Up @@ -48,10 +48,8 @@ public function shouldApplyFulltextOnQuery(bool $isGlobalEdismax): void
}
}

/**
* @test
* @dataProvider provideGlobalEdismax
*/
#[Test]
#[DataProvider('provideGlobalEdismax')]
public function shouldApplyFulltextOnQueryWithDisabledEDisMax(bool $isGlobalEdismax): void
{
$entity = new FulltextBigramDummyEntity(false, $isGlobalEdismax);
Expand Down
22 changes: 9 additions & 13 deletions tests/QueryBuilder/Applicator/FulltextBoostApplicatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
use Lmc\Cqrs\Solr\Fixture\FulltextApplicatorTrait;
use Lmc\Cqrs\Solr\QueryBuilder\Fixture\FulltextBigramBoostDummyEntity;
use Lmc\Cqrs\Solr\QueryBuilder\Fixture\FulltextBoostDummyEntity;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;

class FulltextBoostApplicatorTest extends ApplicatorTestCase
class FulltextBoostApplicatorTest extends AbstractApplicatorTestCase
{
use FulltextApplicatorTrait;

Expand All @@ -17,10 +19,8 @@ protected function setUp(): void
$this->fulltextBoostApplicator = new FulltextBoostApplicator();
}

/**
* @test
* @dataProvider provideGlobalEdismax
*/
#[Test]
#[DataProvider('provideGlobalEdismax')]
public function shouldApplyBoostOnQuery(bool $isGlobalEdismax): void
{
$entity = new FulltextBoostDummyEntity(true, $isGlobalEdismax);
Expand Down Expand Up @@ -59,10 +59,8 @@ public function shouldApplyBoostOnQuery(bool $isGlobalEdismax): void
}
}

/**
* @test
* @dataProvider provideGlobalEdismax
*/
#[Test]
#[DataProvider('provideGlobalEdismax')]
public function shouldApplyBoostAndBigramOptionsOnQuery(bool $isGlobalEdismax): void
{
$entity = new FulltextBigramBoostDummyEntity(true, $isGlobalEdismax);
Expand Down Expand Up @@ -111,10 +109,8 @@ public function shouldApplyBoostAndBigramOptionsOnQuery(bool $isGlobalEdismax):
}
}

/**
* @test
* @dataProvider provideGlobalEdismax
*/
#[Test]
#[DataProvider('provideGlobalEdismax')]
public function shouldApplyFulltextOnQueryWithDisabledEDisMax(bool $isGlobalEdismax): void
{
$entity = new FulltextBigramBoostDummyEntity(false, $isGlobalEdismax);
Expand Down
Loading

0 comments on commit 57ba414

Please sign in to comment.