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 27, 2023
1 parent 2856c9e commit 1d3671a
Show file tree
Hide file tree
Showing 30 changed files with 103 additions and 148 deletions.
26 changes: 23 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
name: build
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'

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

on: [push, pull_request]
name: build

env:
DEFAULT_COMPOSER_FLAGS: "--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi"
Expand All @@ -18,7 +38,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
php: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
mongo: ['3']
mongoext: ['1.8.2', '1.9.0']

Expand Down
19 changes: 3 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@
}
],
"require": {
"yiisoft/yii2": "~2.0.39",
"php": ">=7.3",
"ext-mongodb": ">=1.0.0",
"paragonie/random_compat": ">=1"
"yiisoft/yii2": "~2.0.39"
},
"require-dev": {
"cweagans/composer-patches": "^1.7",
"phpunit/phpunit": "4.8.34"
"phpunit/phpunit": "^9.6"
},
"repositories": [
{
Expand All @@ -38,22 +37,10 @@
"extra": {
"branch-alias": {
"dev-master": "2.1.x-dev"
},
"composer-exit-on-patch-failure": true,
"patches": {
"phpunit/phpunit-mock-objects": {
"Fix PHP 7 and 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_mock_objects.patch"
},
"phpunit/phpunit": {
"Fix PHP 7 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php7.patch",
"Fix PHP 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php8.patch",
"Fix PHP 8.1 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php81.patch"
}
}
},
"config": {
"allow-plugins": {
"cweagans/composer-patches": true,
"yiisoft/yii2-composer": true
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/ActiveDataProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

class ActiveDataProviderTest extends TestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->mockApplication();
ActiveRecord::$db = $this->getConnection();
$this->setUpTestRows();
}

protected function tearDown()
protected function tearDown(): void
{
$this->dropCollection(Customer::collectionName());
parent::tearDown();
Expand Down
6 changes: 3 additions & 3 deletions tests/ActiveFixtureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

class ActiveFixtureTest extends TestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->mockApplication();
}

protected function tearDown()
protected function tearDown(): void
{
$this->dropCollection(Customer::collectionName());
FileHelper::removeDirectory(Yii::getAlias('@runtime/fixtures'));
Expand Down Expand Up @@ -163,4 +163,4 @@ class {$className} extends \yii\mongodb\ActiveFixture
$rows = $this->findAll($this->getConnection()->getCollection(Customer::collectionName()));
$this->assertCount(3, $rows);
}
}
}
6 changes: 3 additions & 3 deletions tests/ActiveRecordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ class ActiveRecordTest extends TestCase
*/
protected $testRows = [];

protected function setUp()
protected function setUp(): void
{
parent::setUp();
ActiveRecord::$db = $this->getConnection();
$this->setUpTestRows();
}

protected function tearDown()
protected function tearDown(): void
{
$this->dropCollection(Customer::collectionName());
parent::tearDown();
Expand Down Expand Up @@ -518,4 +518,4 @@ public function testEmulateExecution()
->distinct('name');
$this->assertSame([], $values);
}
}
}
4 changes: 2 additions & 2 deletions tests/ActiveRelationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

class ActiveRelationTest extends TestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();
ActiveRecord::$db = $this->getConnection();
$this->setUpTestRows();
}

protected function tearDown()
protected function tearDown(): void
{
$this->dropCollection(Customer::collectionName());
$this->dropCollection(CustomerOrder::collectionName());
Expand Down
6 changes: 3 additions & 3 deletions tests/BatchQueryResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

class BatchQueryResultTest extends TestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();
ActiveRecord::$db = $this->getConnection();
$this->setUpTestRows();
}

protected function tearDown()
protected function tearDown(): void
{
$this->dropCollection(Customer::collectionName());
$this->dropCollection(CustomerOrder::collectionName());
Expand Down Expand Up @@ -177,4 +177,4 @@ public function testActiveQuery()
$this->assertEquals(2, count($customers[1]->orders));
$this->assertEquals(2, count($customers[2]->orders));
}
}
}
2 changes: 1 addition & 1 deletion tests/CacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CacheTest extends TestCase
*/
protected static $cacheCollection = '_test_cache';

protected function tearDown()
protected function tearDown(): void
{
$this->dropCollection(static::$cacheCollection);
parent::tearDown();
Expand Down
2 changes: 1 addition & 1 deletion tests/CollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class CollectionTest extends TestCase
{
protected function tearDown()
protected function tearDown(): void
{
$this->dropCollection('customer');
$this->dropCollection('mapReduceOut');
Expand Down
6 changes: 3 additions & 3 deletions tests/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class CommandTest extends TestCase
{
protected function tearDown()
protected function tearDown(): void
{
$this->dropCollection('customer');
parent::tearDown();
Expand Down Expand Up @@ -343,7 +343,7 @@ public function testListCollections()

$collections = $connection->createCommand()->listCollections();
$collectionNames = ArrayHelper::getColumn($collections, 'name');
$this->assertContains('customer', $collectionNames);
$this->assertStringContainsString('customer', $collectionNames);
}

/**
Expand Down Expand Up @@ -372,4 +372,4 @@ public function testUpdateUpsert()
$this->assertEquals(1, $result->getUpsertedCount());
$this->assertEquals(2, $connection->createCommand()->count('customer'));
}
}
}
2 changes: 1 addition & 1 deletion tests/DatabaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class DatabaseTest extends TestCase
{
protected function tearDown()
protected function tearDown(): void
{
$this->dropCollection('customer');
$this->dropFileCollection('testfs');
Expand Down
4 changes: 2 additions & 2 deletions tests/MigrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class MigrationTest extends TestCase
{
protected function tearDown()
protected function tearDown(): void
{
$this->dropCollection('customer');
parent::tearDown();
Expand Down Expand Up @@ -132,4 +132,4 @@ protected function log($string)
{
$this->logs[] = $string;
}
}
}
6 changes: 3 additions & 3 deletions tests/QueryRunTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

class QueryRunTest extends TestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->setUpTestRows();
}

protected function tearDown()
protected function tearDown(): void
{
$this->dropCollection('customer');
parent::tearDown();
Expand Down Expand Up @@ -671,4 +671,4 @@ public function testAggregationShortcuts()
->average('status', $db);
$this->assertEquals(6, $max);
}
}
}
2 changes: 1 addition & 1 deletion tests/SessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class SessionTest extends TestCase
*/
protected static $sessionCollection = '_test_session';

protected function tearDown()
protected function tearDown(): void
{
$this->dropCollection(static::$sessionCollection);
parent::tearDown();
Expand Down
6 changes: 3 additions & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
*/
protected $mongodb;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
if (!extension_loaded('mongodb')) {
Expand All @@ -37,7 +37,7 @@ protected function setUp()
//$this->mockApplication();
}

protected function tearDown()
protected function tearDown(): void
{
if ($this->mongodb) {
$this->mongodb->close();
Expand Down Expand Up @@ -213,4 +213,4 @@ protected function invokeMethod($object, $method, $args = [])
$method->setAccessible(true);
return $method->invokeArgs($object, $args);
}
}
}
2 changes: 0 additions & 2 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@

Yii::setAlias('@yiiunit/extensions/mongodb', __DIR__);
Yii::setAlias('@yii/mongodb', dirname(__DIR__) . '/src');

require_once(__DIR__ . '/compatibility.php');
50 changes: 0 additions & 50 deletions tests/compatibility.php

This file was deleted.

Loading

0 comments on commit 1d3671a

Please sign in to comment.