Repository navigation
Clear the Mago lint findings in the test suite - #254
Open
simon-mundy wants to merge 5 commits into
Open
simon-mundy wants to merge 5 commits into
simon-mundy wants to merge 5 commits into
Conversation
Pass optional literal arguments by name and replace namespace-shaped adapter service names with plain names, matching the documented configuration style.
Use PDO::ERRMODE_SILENT so the failing query takes the same error path without emitting a warning, drop the unreachable suppressed assertions in Sql92Test in favour of asserting the exception message, connect directly instead of swallowing exceptions, and drop unused credentials from the SQLite fixture.
…e names Rename the _get/_isset/_set/_unset/_construct tests, drop their coding standards ignore markers, camel-case the SelectTest data provider variables, and remove a redundant variable and an assignment in an argument.
Replace isset/empty/elseif in test assets and helpers, describe assertions, use a deterministic consecutive return in ResultTest, import the predicate Expression class, interpolate quoted identifiers, and drop a stale commented-out TODO fixture. Remove the lint-baseline entries these commits fixed.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the lint cleanup across SQL, adapter, and result-set tests.
No open issues 🎉
What changed in this PR
This PR cleans up Mago lint findings across the SQL, adapter, and result-set tests without changing production code or gateway tests.
Changes:
- Uses named arguments, clearer test names, and simpler fixture setup.
- Removes error suppression and redundant code, and adds an exception-message assertion.
- Reduces the lint baseline from 153 to 71 findings, retaining intentional exceptions.
| File | Description |
|---|---|
test/unit/Sql/UpdateTest.php |
Imports the predicate expression class. |
test/unit/Sql/TableIdentifierFactoryTest.php |
Uses named factory arguments. |
test/unit/Sql/SqlTest.php |
Renames and relocates the constructor-related test. |
test/unit/Sql/SelectTest.php |
Clarifies fixture names and removes redundant assignments. |
test/unit/Sql/Predicate/PredicateTest.php |
Simplifies expression assertions. |
test/unit/Sql/Platform/AbstractPlatformTest.php |
Uses interpolation for quoted identifiers. |
test/unit/Sql/InsertTest.php |
Renames magic-method tests and removes an unused variable. |
test/unit/Sql/InsertIgnoreTest.php |
Gives magic-method tests descriptive names. |
test/unit/Sql/Ddl/AlterTableTest.php |
Uses named string-replacement arguments. |
test/unit/Sql/AbstractSqlFunctionalTestCase.php |
Updates array-key checks and removes a commented-out fixture. |
test/unit/ResultSet/ResultSetIntegrationTest.php |
Uses named utility-function arguments. |
test/unit/ResultSet/AbstractResultSetTest.php |
Adds an assertion description. |
test/unit/Adapter/Platform/Sql92Test.php |
Removes suppression and checks the exception message. |
test/unit/Adapter/Driver/Pdo/TestAsset/TestConnection.php |
Simplifies constructor flow and DSN initialization. |
test/unit/Adapter/Driver/Pdo/TestAsset/SqliteMemoryPdo.php |
Types the SQL argument and makes empty-value checks explicit. |
test/unit/Adapter/Driver/Pdo/StatementTest.php |
Separates PDO creation from method arguments. |
test/unit/Adapter/Driver/Pdo/StatementIntegrationTest.php |
Separates mock creation from initialization. |
test/unit/Adapter/Driver/Pdo/ResultTest.php |
Uses deterministic mock results and describes an assertion. |
test/unit/Adapter/Driver/Pdo/PdoTest.php |
Removes an unused assignment. |
test/unit/Adapter/Driver/Pdo/ConnectionTransactionsTest.php |
Avoids unnecessary counter mutations in assertions. |
test/unit/Adapter/Driver/Pdo/ConnectionTest.php |
Removes suppression, an empty catch, and redundant setup. |
test/unit/Adapter/Container/AbstractAdapterInterfaceFactoryTest.php |
Simplifies service names and labels provider cases. |
test/unit/Adapter/AdapterTest.php |
Separates profiler creation from assignment. |
lint-baseline.toml |
Removes entries for resolved lint findings. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
lint-baseline.tomlcarried 92 Mago lint findings in the test suite (test/unit/Sql,test/unit/Adapter,test/unit/ResultSet), including:@error suppression and an emptycatch;Fix
TableIdentifierFactory::__invoke,str_replace,random_int,var_export,assert).AbstractAdapterInterfaceFactoryTestuses plain adapter service names (WriteAdapter,ReadAdapter), matching the docs, and its data providers are labelled.@suppression:PDO::ERRMODE_SILENT. The failing query takes the samefalsepath and still throwsInvalidQueryException, without emitting a warning.Sql92Test::quoteValueThrowsWithoutDriverdrops assertions that could never run after the first throw, and checks the exception message instead.catch, redundant variables and assignments inside arguments are removed._get,_isset,_set,_unsetand_constructtests get behaviour-describing camelCase names, and lose their@codingStandardsIgnoremarkers.SelectTest's provider variables are camelCased.isset,emptyandelseifare replaced (??=, early returns,array_key_exists()).Predicate\Expressionis imported instead of written as a fully qualified name.What stays the same
src/changes. No assertion is weakened, and one exception-message assertion is added.no-isset×6, where the test checks thatisset()reachesArrayAccessor__isset;halstead×2, on two data providers that are large fixture tables;excessive-parameter-listandno-boolean-flag-parameteronSelectTest::prepareStatement, whose signature has to match the shared provider's row shape.Verification
mago format --check,lint,analyzeandguardexit 0 on PHP 8.3, 8.4 and 8.5, with no stale baseline entries.0.6.x, and no warnings or notices.