Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .github/workflows/composer-require-checker.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
on:
pull_request:
paths:
paths: &paths
- 'src/**'
- '.github/workflows/composer-require-checker.yml'
- 'composer.json'
- 'composer-require-checker.json'

push:
branches: ['master']
paths:
- 'src/**'
- '.github/workflows/composer-require-checker.yml'
- 'composer.json'
- 'composer-require-checker.json'
paths: *paths

name: Composer require checker

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/rector-cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
paths:
- 'src/**'
- 'config/**'
- 'tests/**'
- '.github/workflows/rector-cs.yml'
- 'composer.json'
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
on:
pull_request:
paths:
paths: &paths
- 'src/**'
- 'config/**'
- '.github/workflows/static.yml'
- 'psalm*.xml'
- 'composer.json'

push:
branches: ['master']
paths:
- 'src/**'
- '.github/workflows/static.yml'
- 'psalm*.xml'
- 'composer.json'
paths: *paths

name: Static analysis

Expand All @@ -25,6 +22,6 @@ jobs:
uses: yiisoft/actions/.github/workflows/psalm.yml@master
with:
php: >-
['8.1', '8.2', '8.3', '8.4']
['8.1', '8.2', '8.3', '8.4', '8.5']
required-packages: >-
['db']
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Bug #550: Relation query should be created by related class, not primary model class (@batyrmastyr)
- Enh #571: Optimize performance of `ActiveRecord::get()` method (@Tigrov)
- Enh #575: Remove check for empty string in `AbstractActiveRecord::markPropertyChanged()` method (@Tigrov)
- Enh #576: Add default config for `yiisoft/config` plugin (@Tigrov)

## 1.0.2 March 11, 2026

Expand Down
12 changes: 10 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"yiisoft/event-dispatcher": "^1.1",
"yiisoft/factory": "^1.3",
"yiisoft/psr-dummy-provider": "^1.0",
"yiisoft/test-support": "^3.0.2"
"yiisoft/test-support": "^3.0.2",
"yiisoft/yii-runner": "^2.2"
},
"suggest": {
"yiisoft/arrays": "For \\Yiisoft\\Arrays\\ArrayableInterface support",
Expand All @@ -75,13 +76,20 @@
"bin-links": true,
"target-directory": "tools",
"forward-command": true
},
"config-plugin-options": {
"source-directory": "config"
},
"config-plugin": {
"bootstrap": "bootstrap.php"
}
},
"config": {
"sort-packages": true,
"allow-plugins": {
"bamarni/composer-bin-plugin": true,
"composer/package-versions-deprecated": true
"composer/package-versions-deprecated": true,
"yiisoft/config": false
}
},
"scripts": {
Expand Down
16 changes: 16 additions & 0 deletions config/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

use Psr\Container\ContainerInterface;
use Yiisoft\Db\Connection\ConnectionInterface;
use Yiisoft\Db\Connection\ConnectionProvider;

/**
* @psalm-var list<callable(ContainerInterface): void>
*/
return [
static function (ContainerInterface $container): void {
ConnectionProvider::set($container->get(ConnectionInterface::class));
},
];
65 changes: 65 additions & 0 deletions tests/Driver/Sqlite/ConfigTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

declare(strict_types=1);

namespace Yiisoft\ActiveRecord\Tests\Driver\Sqlite;

use PHPUnit\Framework\TestCase;
use Psr\SimpleCache\CacheInterface;
use Yiisoft\Db\Connection\ConnectionInterface;
use Yiisoft\Db\Connection\ConnectionProvider;
use Yiisoft\Db\Sqlite\Connection as SQLiteConnection;
use Yiisoft\Db\Sqlite\Driver as SQLiteDriver;
use Yiisoft\Di\Container;
use Yiisoft\Di\ContainerConfig;
use Yiisoft\Test\Support\SimpleCache\MemorySimpleCache;
use Yiisoft\Yii\Runner\BootstrapRunner;

use function dirname;

final class ConfigTest extends TestCase
{
protected function tearDown(): void
{
if (ConnectionProvider::has()) {
ConnectionProvider::get()->close();
ConnectionProvider::remove();
}

parent::tearDown();
}

public function testBootstrap(): void
{
$container = $this->createContainer();
$bootstrapList = $this->getBootstrapList();

$this->assertFalse(ConnectionProvider::has());

(new BootstrapRunner($container, $bootstrapList))->run();

$this->assertTrue(ConnectionProvider::has());
$this->assertInstanceOf(SQLiteConnection::class, ConnectionProvider::get());
}

private function createContainer(): Container
{
$config = ContainerConfig::create()
->withDefinitions([
CacheInterface::class => MemorySimpleCache::class,
ConnectionInterface::class => [
'class' => SQLiteConnection::class,
'__construct()' => [
'driver' => new SQLiteDriver('sqlite::memory:'),
],
],
]);

return new Container($config);
}

private function getBootstrapList(): array
{
return require dirname(__DIR__, 3) . '/config/bootstrap.php';
}
}
Loading