From a856939d7f8fea58c6610b1be452c1ecedcd4381 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Sat, 21 Nov 2026 00:03:51 +0400 Subject: [PATCH 1/2] test(bridge): bind the facade through the Laravel provider and the Yii 3 bootstrap Assisted-By: Claude Opus 5.5 --- tests/Unit/BridgeTest.php | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/Unit/BridgeTest.php diff --git a/tests/Unit/BridgeTest.php b/tests/Unit/BridgeTest.php new file mode 100644 index 0000000..a782322 --- /dev/null +++ b/tests/Unit/BridgeTest.php @@ -0,0 +1,49 @@ +register(); + + Assert::same(Facade::getOrm(), $orm); + } + + public function yiiBootstrapBindsTheContainerIntoTheFacade(): void + { + $orm = Memory::orm(); + $bootstrap = require \dirname(__DIR__, 2) . '/src/Bridge/Yii3/yii-bootstrap.php'; + + $bootstrap['cycle-active-record'](ConfigurableContainer::returning(ORMInterface::class, $orm)); + + Assert::same(Facade::getOrm(), $orm); + } +} From e996dd996664bc8d49ed28d2dacdd202101a68ab Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Sat, 21 Nov 2026 00:03:52 +0400 Subject: [PATCH 2/2] test: resolve the deprecated transaction aliases and build an ActiveQuery in the Unit suite On PHP 8.5 the Unit report marked the ActiveQuery constructor as an unexecuted line no other suite reports, which Codecov counted as missed. Assisted-By: Claude Opus 5.5 --- tests/Unit/ActiveQueryTest.php | 48 ++++++++++++++++++++++++++++++ tests/Unit/DeprecatedAliasTest.php | 29 ++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 tests/Unit/ActiveQueryTest.php create mode 100644 tests/Unit/DeprecatedAliasTest.php diff --git a/tests/Unit/ActiveQueryTest.php b/tests/Unit/ActiveQueryTest.php new file mode 100644 index 0000000..1bbbcfa --- /dev/null +++ b/tests/Unit/ActiveQueryTest.php @@ -0,0 +1,48 @@ + [ + SchemaInterface::ENTITY => \stdClass::class, + SchemaInterface::DATABASE => 'default', + SchemaInterface::TABLE => 'notes', + SchemaInterface::PRIMARY_KEY => 'id', + SchemaInterface::COLUMNS => ['id', 'text'], + SchemaInterface::SCHEMA => [], + SchemaInterface::RELATIONS => [], + ], + ]); + Facade::setContainer(ConfigurableContainer::returning(ORMInterface::class, $orm)); + + $query = new ActiveQuery('note'); + + Assert::same($query->getRole(), 'note'); + Assert::string($query->sqlStatement())->contains('FROM "notes"'); + } +} diff --git a/tests/Unit/DeprecatedAliasTest.php b/tests/Unit/DeprecatedAliasTest.php new file mode 100644 index 0000000..49231c4 --- /dev/null +++ b/tests/Unit/DeprecatedAliasTest.php @@ -0,0 +1,29 @@ +getName(), TransactionException::class); + } +}