Update cases where one of the IConnectionProvider methods is called
immediately.
This doesn't really change anything, but I hope it helps promote
getConnectionProvider() as the common way to do this.
Follow-up to 8604c384f6.
Change-Id: Id0e7d02bab0c570343c2b1f03c70b44ee39db112
Follow up Id9ab64fc8b09d9 which made listTables() consistently exclude
views.
Hard deprecate Database::listViews() which was only used for view
filtering of listTables(), conditional on database type.
Add an integration test for the new listTables() behaviour.
Change-Id: I3402a227f92b35192c6385c6aeab461de43b9f58
Also fix callers that were checking for t/f.
In CASE and COALESCE expressions, using 't' and 'f' did actually work,
because those literals have an unknown type and the other argument is
boolean, so PG coerces them to boolean. But it seems safer and clearer
to use the strongly typed literals TRUE and FALSE.
Bug: T352229
Change-Id: Ia01b76d3d6d2e048feac8e3118d9faff63a9ac56
With PHPUnit 9, tests without @covers tags are considered risky and emit
warnings. Not having @covers is bad practice anyway, so use
@coversNothing instead to make the intention clear, and re-enable the
phpcs rule.
Also rewrite an assertion in ResourcesTest that was bothering me.
Bug: T243600
Change-Id: I6dd683f93b6b2faed5f107be2ca7860602277fbc
- Allow to specify a folder with --sql and get the name from json
filename or use the default sql filename.
- Show output that the script has something done.
Change-Id: I0dbec168efac465c962ab7184953bc2461e85d1d
Postgres:
- Change page_namespace from smallint to int
- Change page_random from numeric with arbitrary precision to float
- Make page_touched not nullable
MySQL/SQLite:
- Change datatype of page_title from varchar (with binary collation)
to varbinary(255)
- Drop default empty string from timestamp field of page_touched
Bug: T230428
Bug: T164898
Change-Id: Ibdaf332ea1da309d31d35a6ebbc1b8fefced335e
This table is massive but thankfully we fixed most of its complexities
in previous patches.
For MySQL/Sqlite:
- Change type of rc_title and rc_source from "varchar binary" to
"varbinary"
- Drop default of rc_timestamp
- Change rc_timestamp from varbinary(14) to binary(14) to standardize
timestamp datatypes
One index doesn't follow the uniform prefix rule but since it's in a
maintenance script, will fix that in a follow up.
Bug: T230428
Bug: T42626
Change-Id: I13994e02ad3a2293148346ef7be96746578ad854
The name change happened some time ago, and I think its
about time to start using the name name!
(Done with a find and replace)
My personal motivation for doing this is that I have started
trying out vscode as an IDE for mediawiki development, and
right now it doesn't appear to handle php aliases very well
or at all.
Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
As was pointed out in CR on the original change from December 2011, the
test requires elevated privileges when it is run against a database with
binlogging enabled, which is a nuisance when I'm trying to test replication-
related code. The author commented that the test was to support GeoData,
but that was only true until the "schema revamp" of February 2012.
I considered mocking the database and making it into a test of
streamStatementEnd, since that code was introduced at the same time, but
we already have DatabaseMysqlBaseTest::testStreamStatementEnd().
I also removed the restoreFlags() call since that was apparently left
over from testFlagSetting(), which has been moved to DatabaseTest.
Refs:
* https://www.mediawiki.org/wiki/Special:Code/MediaWiki/107376
* https://www.mediawiki.org/wiki/Special:Code/MediaWiki/108603
* https://www.mediawiki.org/wiki/Special:Code/MediaWiki/110649
* 67f08d6990
Change-Id: I1a6b9d0cd91c8539ac1080a423b519743088733e
This helps preventing mistakes, for example if you don't know or you
forget to generate the sql schema for one or all of them.
Also it helps preventing malicious changes to the generated files that
might go in without much scrutiny as the manual files.
Bug: T252919
Change-Id: I50e2715a55914f7712f9925c149bd09e8265a20b
Done automatically using the master version of MW codesniffer and
running composer fix.
Bug: T192167
Change-Id: If6b40f515fde32ab5eff074a90e821c30c791827
@covers does not make any sense for structure tests, which either
do not cover any PHP lines (they test things like configuration or
messages), or cover lines which cannot be determined at the time
of writing the tests (e.g. they cover all classes implementing a
certain interface). Requiring @coversNothing to be manually added
for all of them is a waste of developer time.
tests/phpunit/suite.xml has forceCoversAnnotation=true so removing
the annotations will not change test coverage, these files will
still be skipped.
Change-Id: I27cb58e92341b9b1a76f109701f5bc843adbaa9b
LessFileCompilationTest is checking less files for valid syntax
doc test is checking xml file for valid syntax
MediaWikiTest is testing a complex situation with many functions involved
SideBarTest is self checking, needs no coverage
structure tests not covers functions, there are covers global structures
Change-Id: I3ac65db561cae0be8418aa9c830e7a9f46ad11fe
* Move DatabaseTest and DatabaseSQLTest to libs,
and remove MediaWikiTestCase dependency.
* Refactor DatabaseTest to be a test of the Database abstract class,
not of whatever current DB backend is configured by LocalSettings.
- Remove most switches/conditionals and other tests for specific
database backends. Move those to individual test classes for
those backends instead.
- Some tests appear to have been integration tests for the PHP driver
and/or the db backend itself. Moved to a new DatabaseIntegrationTest.
- Now that only the abstract Database is invoked, the test runs a bit
faster (no real connections/queries).
* Add missing @covers tags, and remove or fix broken ones
(follows-up 26e52f0c49).
Change-Id: I9dc4a558e701d00e95789e7eb8e02926783b65ad