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
6 changes: 2 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
.github/ export-ignore
.phan/ export-ignore
docs/ export-ignore
Tests/ export-ignore
.appveyor.yml export-ignore
.drone.jsonnet export-ignore
.drone.yml export-ignore
.editorconfig export-ignore
.git-blame-ignore-revs export-ignore
.gitattributes export-ignore
.gitignore export-ignore
phpstan.neon export-ignore
phpstan-baseline.neon export-ignore
phpunit.*.xml.dist export-ignore
phpunit.xml.dist export-ignore
ruleset.xml export-ignore
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
composer:
name: Install PHP dependencies
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:php8.1
container: joomlaprojects/docker-images:php8.3
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
Expand All @@ -32,7 +32,7 @@ jobs:
code-style-php:
name: Check PHP code style
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:php8.1
container: joomlaprojects/docker-images:php8.3
needs: [composer]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
needs: [code-style-php]
strategy:
matrix:
php_version: ['8.1', '8.2', '8.3', '8.4']
php_version: ['8.3', '8.4']
steps:
- uses: actions/checkout@v4
- name: Run Unit tests
Expand All @@ -84,7 +84,7 @@ jobs:
needs: [code-style-php]
strategy:
matrix:
php_version: ['8.1', '8.2', '8.3', '8.4']
php_version: ['8.3', '8.4']
db_engine: ['mysql', 'mysqli']
db_version: ['5.7', '8.0']
steps:
Expand All @@ -110,7 +110,7 @@ jobs:
needs: [code-style-php]
strategy:
matrix:
php_version: ['8.1', '8.2', '8.3', '8.4']
php_version: ['8.3', '8.4']
steps:
- uses: actions/checkout@v4
- name: Run Unit tests
Expand All @@ -134,7 +134,7 @@ jobs:
needs: [code-style-php]
strategy:
matrix:
php_version: ['8.1', '8.2', '8.3', '8.4']
php_version: ['8.3', '8.4']
db_version: ['10', '11']
steps:
- uses: actions/checkout@v4
Expand All @@ -158,7 +158,7 @@ jobs:
needs: [code-style-php]
strategy:
matrix:
php_version: ['8.1', '8.2', '8.3', '8.4']
php_version: ['8.3', '8.4']
steps:
- uses: actions/checkout@v4
- name: Run Unit tests
Expand Down Expand Up @@ -190,7 +190,7 @@ jobs:
needs: [code-style-php]
strategy:
matrix:
php_version: ['8.1', '8.2', '8.3', '8.4']
php_version: ['8.3', '8.4']
steps:
- uses: actions/checkout@v4
- name: Setup PHP
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,24 +173,24 @@ This is the log file:

## Installation via Composer

Add `"joomla/database": "~3.0"` to the require block in your composer.json and then run `composer install`.
Add `"joomla/database": "~4.0"` to the require block in your composer.json and then run `composer install`.

```json
{
"require": {
"joomla/database": "~3.0"
"joomla/database": "~4.0"
}
}
```

Alternatively, you can simply run the following from the command line:

```sh
composer require joomla/database "~3.0"
composer require joomla/database "~4.0"
```

If you want to include the test sources, use

```sh
composer require --prefer-source joomla/database "~3.0"
composer require --prefer-source joomla/database "~4.0"
```
3 changes: 2 additions & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
These versions are currently being supported with security updates:

| Version | Supported |
| ------- | ------------------ |
|---------| ------------------ |
| 4.x.x | :white_check_mark: |
| 3.x.x | :white_check_mark: |
| 2.0.x | :white_check_mark: |
| 1.8.x | :x: |
Expand Down
42 changes: 20 additions & 22 deletions Tests/AbstractDatabaseDriverTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Joomla\Database\ParameterType;
use Joomla\Database\QueryInterface;
use Joomla\Test\DatabaseTestCase;
use PHPUnit\Framework\Attributes\DataProvider;

/**
* Base test class for Joomla\Database\DatabaseDriver
Expand Down Expand Up @@ -72,23 +73,24 @@ public function testIsConnectionEncryptionSupported()
/**
* Data provider for table dropping test cases
*
* @return \Generator
* @return array
*/
public function dataDropTable()
public static function dataDropTable(): array
{
yield 'database exists before query' => ['#__dbtest', true];
return [
'database exists before query' => ['#__dbtest', true],

yield 'database does not exist before query' => ['#__foo', false];
'database does not exist before query' => ['#__foo', false],
];
}

/**
* @testdox A database table can be dropped
*
* @param string $table The name of the database table to drop.
* @param boolean $alreadyExists Flag indicating the table should exist before the DROP TABLE query.
*
* @dataProvider dataDropTable
*/
#[DataProvider('dataDropTable')]
public function testDropTable(string $table, bool $alreadyExists)
{
$this->assertSame(
Expand All @@ -110,19 +112,18 @@ public function testDropTable(string $table, bool $alreadyExists)
/**
* Data provider for escaping test cases
*
* @return \Generator
* @return array
*/
abstract public function dataEscape(): \Generator;
abstract public static function dataEscape(): array;

/**
* @testdox Text can be escaped
*
* @param string $text The string to be escaped.
* @param boolean $extra Optional parameter to provide extra escaping.
* @param string $expected The expected result.
*
* @dataProvider dataEscape
*/
#[DataProvider('dataEscape')]
public function testEscape($text, $extra, $expected)
{
$this->assertSame(
Expand Down Expand Up @@ -240,19 +241,18 @@ public function testGetIterator()
/**
* Data provider for fetching table column test cases
*
* @return \Generator
* @return array
*/
abstract public function dataGetTableColumns(): \Generator;
abstract public static function dataGetTableColumns(): array;

/**
* @testdox Information about the columns of a database table is returned
*
* @param string $table The name of the database table.
* @param boolean $typeOnly True (default) to only return field types.
* @param array $expected Expected result.
*
* @dataProvider dataGetTableColumns
*/
#[DataProvider('dataGetTableColumns')]
public function testGetTableColumns(string $table, bool $typeOnly, array $expected)
{
$this->assertEquals(
Expand Down Expand Up @@ -596,18 +596,17 @@ public function testLockAndUnlockTable()
/**
* Data provider for binary quoting test cases
*
* @return \Generator
* @return array
*/
abstract public function dataQuoteBinary(): \Generator;
abstract public static function dataQuoteBinary(): array;

/**
* @testdox A binary value is quoted properly
*
* @param string $data The binary quoted input string.
* @param string $expected The expected result.
*
* @dataProvider dataQuoteBinary
*/
#[DataProvider('dataQuoteBinary')]
public function testQuoteBinary($data, $expected)
{
$this->assertSame($expected, static::$connection->quoteBinary($data));
Expand All @@ -616,19 +615,18 @@ public function testQuoteBinary($data, $expected)
/**
* Data provider for name quoting test cases
*
* @return \Generator
* @return array
*/
abstract public function dataQuoteName(): \Generator;
abstract public static function dataQuoteName(): array;

/**
* @testdox A value is name quoted properly
*
* @param array|string $name The identifier name to wrap in quotes, or an array of identifier names to wrap in quotes.
* @param array|string $as The AS query part associated to $name.
* @param array|string $expected The expected result.
*
* @dataProvider dataQuoteName
*/
#[DataProvider('dataQuoteName')]
public function testQuoteName($name, $as, $expected)
{
$this->assertSame(
Expand Down
Loading