Skip to content

Conversation

@terabytesoftw
Copy link
Member

Q A
Is bugfix? ✔️
New feature?
Breaks BC?

Before:

There were 13 skipped tests:

1) yiiunit\framework\db\sqlite\CommandTest::testAddDropPrimaryKey
SQLite does not support adding/dropping primary keys.

/home/runner/work/yii2/yii2/tests/framework/db/sqlite/CommandTest.php:47
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

2) yiiunit\framework\db\sqlite\CommandTest::testAddDropForeignKey
SQLite does not support adding/dropping foreign keys.

/home/runner/work/yii2/yii2/tests/framework/db/sqlite/CommandTest.php:52
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

3) yiiunit\framework\db\sqlite\CommandTest::testAddDropUnique
SQLite does not support adding/dropping unique constraints.

/home/runner/work/yii2/yii2/tests/framework/db/sqlite/CommandTest.php:57
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

4) yiiunit\framework\db\sqlite\CommandTest::testAddDropCheck
SQLite does not support adding/dropping check constraints.

/home/runner/work/yii2/yii2/tests/framework/db/sqlite/CommandTest.php:62
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

5) yiiunit\framework\db\sqlite\CommandTest::testAlterTable
Sqlite does not support alterTable

/home/runner/work/yii2/yii2/tests/framework/db/CommandTest.php:745
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

6) yiiunit\framework\db\sqlite\CommandTest::testAddDropDefaultValue
sqlite does not support adding/dropping default value constraints.

/home/runner/work/yii2/yii2/tests/framework/db/CommandTest.php:1248
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

7) yiiunit\framework\db\sqlite\ConnectionTest::testExceptionContainsRawQuery
This test does not work on sqlite because preparing the failing query fails

/home/runner/work/yii2/yii2/tests/framework/db/sqlite/ConnectionTest.php:224
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

8) yiiunit\framework\db\sqlite\QueryBuilderTest::testCommentColumn
Comments are not supported in SQLite

/home/runner/work/yii2/yii2/tests/framework/db/sqlite/QueryBuilderTest.php:118
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

9) yiiunit\framework\db\sqlite\QueryBuilderTest::testCommentTable
Comments are not supported in SQLite

/home/runner/work/yii2/yii2/tests/framework/db/sqlite/QueryBuilderTest.php:123
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

10) yiiunit\framework\db\sqlite\QueryBuilderTest::testBatchInsertOnOlderVersions
This test is only relevant for SQLite < 3.7.11

/home/runner/work/yii2/yii2/tests/framework/db/sqlite/QueryBuilderTest.php:137
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

11) yiiunit\framework\db\sqlite\QueryTest::testCountHavingWithoutGroupBy
sqlite does not support having without group by.

/home/runner/work/yii2/yii2/tests/framework/db/QueryTest.php:511
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

12) yiiunit\framework\db\sqlite\SchemaTest::testGetSchemaNames
Schemas are not supported in SQLite.

/home/runner/work/yii2/yii2/tests/framework/db/sqlite/SchemaTest.php:25
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

13) yiiunit\framework\log\SqliteTargetTest::testTransactionRollBack
It is not possible to test logging during transaction when the DB is in memory

/home/runner/work/yii2/yii2/tests/framework/log/SqliteTargetTest.php:23
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

OK, but incomplete, skipped, or risky tests!
Tests: 719, Assertions: 3114, Skipped: 13.

After:

There were 7 skipped tests:

1) yiiunit\framework\db\sqlite\ConnectionTest::testExceptionContainsRawQuery
This test does not work on sqlite because preparing the failing query fails

/home/runner/work/yii2/yii2/tests/framework/db/sqlite/ConnectionTest.php:224
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

2) yiiunit\framework\db\sqlite\QueryBuilderTest::testCommentColumn
Comments are not supported in SQLite

/home/runner/work/yii2/yii2/tests/framework/db/sqlite/QueryBuilderTest.php:118
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

3) yiiunit\framework\db\sqlite\QueryBuilderTest::testCommentTable
Comments are not supported in SQLite

/home/runner/work/yii2/yii2/tests/framework/db/sqlite/QueryBuilderTest.php:123
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

4) yiiunit\framework\db\sqlite\QueryBuilderTest::testBatchInsertOnOlderVersions
This test is only relevant for SQLite < 3.7.11

/home/runner/work/yii2/yii2/tests/framework/db/sqlite/QueryBuilderTest.php:137
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

5) yiiunit\framework\db\sqlite\QueryTest::testCountHavingWithoutGroupBy
sqlite does not support having without group by.

/home/runner/work/yii2/yii2/tests/framework/db/QueryTest.php:511
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

6) yiiunit\framework\db\sqlite\SchemaTest::testGetSchemaNames
Schemas are not supported in SQLite.

/home/runner/work/yii2/yii2/tests/framework/db/sqlite/SchemaTest.php:25
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

7) yiiunit\framework\log\SqliteTargetTest::testTransactionRollBack
It is not possible to test logging during transaction when the DB is in memory

/home/runner/work/yii2/yii2/tests/framework/log/SqliteTargetTest.php:23
/home/runner/work/yii2/yii2/vendor/bin/phpunit:122

OK, but incomplete, skipped, or risky tests!
Tests: 725, Assertions: 3148, Skipped: 7.

Copilot AI review requested due to automatic review settings October 28, 2025 20:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors SQLite-specific tests to verify that unsupported operations throw NotSupportedException instead of skipping them, and improves test coverage by parameterizing constraint tests with data providers. The changes also include code formatting improvements and better use of type hints.

Key Changes

  • Converted SQLite constraint tests from markTestSkipped to actually testing that NotSupportedException is thrown
  • Refactored primary key, foreign key, and unique constraint tests to use data providers for better test coverage
  • Improved code formatting and consistency across test files

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/framework/db/CommandTest.php Added data providers for constraint tests, refactored tests to accept parameterized inputs, improved MySQL version check specificity, and enhanced code formatting
tests/framework/db/sqlite/CommandTest.php Changed SQLite tests to verify NotSupportedException is thrown for unsupported operations, added new test methods, improved code formatting, and updated exception handling patterns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@terabytesoftw terabytesoftw requested a review from Copilot October 28, 2025 21:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@terabytesoftw terabytesoftw merged commit ed6989d into yiisoft:master Oct 29, 2025
92 of 94 checks passed
@terabytesoftw terabytesoftw deleted the fix-sqlite-tests-1 branch October 29, 2025 14:52
samdark added a commit that referenced this pull request Oct 30, 2025
Co-authored-by: Maksim Spirkov <[email protected]>
Co-authored-by: Samuel Rajan D <[email protected]>
Fix #20640: Fix `@param` annotation for `$block` in `yii\console\Markdown::renderParagraph()`
Fix #20645: Add missing generics in `yii\helpers` and `yii\test` namespaces. Fix PHPDoc annotations in `ArrayAccessTrait`
Fix #20651: Add missing generics in `yii\filters` namespace
Fix #20654: Add missing generics in `yii\db` namespace. Fix PHPDoc annotations in `yii\db\ArrayExpression`
Fix #20650: Add PHPStan/Psalm annotations for `yii\di\Container`
Fix SQLite `CommandTest` skipped tests and minor fixes. (#20648)
Fix #20642: Pass `$model` and `$attribute` in Compare Validator's compareValue property closure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants