Skip to content

Commit

Permalink
Raise min version to PHP 7.3, check compatibility PHP 8.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Sep 28, 2023
1 parent d697c96 commit 031ed8c
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 63 deletions.
29 changes: 23 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
on:
- pull_request
- push
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'

push:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'

name: build

Expand All @@ -16,12 +33,12 @@ jobs:
strategy:
matrix:
php-version:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- 8.0
- 8.1
- 8.2
- 8.3

es-version:
- 8.1.3
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
}
],
"require": {
"yiisoft/yii2": "~2.0.14",
"php": ">=7.3",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"paragonie/random_compat": ">=1"
"yiisoft/yii2": "~2.0.14"
},
"require-dev": {
"phpunit/phpunit": "4.8.27|~5.7.21|^6.2"
"phpunit/phpunit": "^9.6"
},
"autoload": {
"psr-4": { "yii\\elasticsearch\\": "" }
Expand Down
2 changes: 1 addition & 1 deletion tests/ActiveDataProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

Expand Down
4 changes: 2 additions & 2 deletions tests/ActiveQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
class ActiveQueryTest extends TestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down Expand Up @@ -42,4 +42,4 @@ public function testColumn()
$result = $activeQuery->scalar('name', $this->getConnection());
$this->assertEquals('item1', $result);
}
}
}
6 changes: 3 additions & 3 deletions tests/ActiveRecordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getOrderItemClass()
return OrderItem::className();
}

public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down Expand Up @@ -163,7 +163,7 @@ public function testSearch()
$this->assertTrue($customer instanceof Customer);
$this->assertEquals(2, $customer->_id);
}

public function testSuggestion()
{
$result = Customer::find()->addSuggester('customer_name', [
Expand All @@ -175,7 +175,7 @@ public function testSuggestion()

$this->assertCount(3, $result['suggest']['customer_name'][0]['options']);
}

public function testGetDb()
{
$this->mockApplication(['components' => ['elasticsearch' => Connection::className()]]);
Expand Down
5 changes: 3 additions & 2 deletions tests/ActiveRecordTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -1141,13 +1141,14 @@ public function testViaWithCallable()
$cheapItems = $order->cheapItemsUsingViaWithCallable;

$this->assertCount(2, $expensiveItems);

$expensiveItemIds = [
$expensiveItems[0]->_id,
$expensiveItems[1]->_id,
];
$this->assertContains(4, $expensiveItemIds);
$this->assertContains(5, $expensiveItemIds);

$this->assertContains('4', $expensiveItemIds);
$this->assertContains('5', $expensiveItemIds);
$this->assertCount(1, $cheapItems);
$this->assertEquals(3, $cheapItems[0]->_id);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CommandTest extends TestCase
/** @var Command */
private $command;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->command = $this->getConnection()->createCommand();
Expand Down
2 changes: 1 addition & 1 deletion tests/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ConnectionTest extends TestCase
*/
private $connection;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->connection = $this->getConnection();
Expand Down
4 changes: 2 additions & 2 deletions tests/ElasticsearchTargetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function testExport()
$this->assertArrayHasKey('category', $source);
}

protected function setUp()
protected function setUp(): void
{
parent::setUp();

Expand All @@ -61,7 +61,7 @@ protected function setUp()
]);
}

protected function tearDown()
protected function tearDown(): void
{
$command = $this->getConnection()->createCommand();
$command->deleteIndex($this->index);
Expand Down
2 changes: 1 addition & 1 deletion tests/QueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class QueryBuilderTest extends TestCase
*/
private $version;

public function setUp()
protected function setUp(): void
{
parent::setUp();
$command = $this->getConnection()->createCommand();
Expand Down
3 changes: 2 additions & 1 deletion tests/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
class QueryTest extends TestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down Expand Up @@ -457,6 +457,7 @@ public function testRuntimeMappings()
// Check that Elasticsearch is version 7.11.0 or later before running this test
$elasticsearchInfo = $this->getConnection()->get('/');
if(!version_compare($elasticsearchInfo['version']['number'], '7.11.0', '>=')) {
$this->expectNotToPerformAssertions();
return;
}

Expand Down
10 changes: 2 additions & 8 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
use yii\helpers\ArrayHelper;
use Yii;

// backward compatibility
if (!class_exists('\PHPUnit\Framework\TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}


/**
* This is the base class for all yii framework unit tests.
*/
Expand Down Expand Up @@ -40,7 +34,7 @@ public static function getParam($name, $default = null)
* Clean up after test.
* By default the application created with [[mockApplication]] will be destroyed.
*/
protected function tearDown()
protected function tearDown(): void
{
parent::tearDown();
$this->destroyApplication();
Expand Down Expand Up @@ -86,7 +80,7 @@ protected function destroyApplication()
Yii::$container = new Container();
}

protected function setUp()
protected function setUp(): void
{
$this->mockApplication();

Expand Down
32 changes: 0 additions & 32 deletions tests/compatibility.php

This file was deleted.

0 comments on commit 031ed8c

Please sign in to comment.