Skip to content

Commit

Permalink
Merge pull request #4721 from jeromegamez/mysql8
Browse files Browse the repository at this point in the history
  • Loading branch information
MGatner authored May 22, 2021
2 parents b3e9057 + 5a3625d commit f925658
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/test-phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@ jobs:
matrix:
php-versions: ['7.3', '7.4', '8.0']
db-platforms: ['MySQLi', 'Postgre', 'SQLite3', 'SQLSRV']
mysql-versions: ['5.7']
include:
- php-versions: 7.4
db-platforms: MySQLi
mysql-versions: 8.0

services:
mysql:
image: mysql:5.7
image: mysql:${{ matrix.mysql-versions }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: test
Expand Down Expand Up @@ -133,7 +138,7 @@ jobs:
DB: ${{ matrix.db-platforms }}
TERM: xterm-256color

- if: matrix.php-versions == '7.4'
- if: github.repository_owner == 'codeigniter4' && matrix.php-versions == '7.4'
name: Run Coveralls
run: |
composer global require php-coveralls/php-coveralls:^2.4
Expand All @@ -144,6 +149,7 @@ jobs:
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }}

coveralls-finish:
if: github.repository_owner == 'codeigniter4'
needs: [tests]
runs-on: ubuntu-20.04
steps:
Expand Down
20 changes: 17 additions & 3 deletions tests/system/Database/Live/ForgeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,16 @@ public function testCreateTableWithArrayFieldConstraints()
public function testCreateTableWithNullableFieldsGivesNullDataType(): void
{
$this->forge->addField([
'id' => ['type' => 'INT', 'constraint' => 11, 'auto_increment' => true],
'name' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'id' => [
'type' => 'INT',
'constraint' => 11,
'auto_increment' => true,
],
'name' => [
'type' => 'VARCHAR',
'constraint' => 255,
'null' => true,
],
]);

$createTable = $this->getPrivateMethodInvoker($this->forge, '_createTable');
Expand Down Expand Up @@ -620,7 +628,13 @@ public function testAddFields()
$this->assertEquals($fieldsData[0]->type, 'int');
$this->assertEquals($fieldsData[1]->type, 'varchar');

$this->assertEquals($fieldsData[0]->max_length, 11);
if (version_compare($this->db->getVersion(), '8.0.17', '<'))
{
// As of MySQL 8.0.17, the display width attribute for integer data types
// is deprecated and is not reported back anymore.
// @see https://dev.mysql.com/doc/refman/8.0/en/numeric-type-attributes.html
$this->assertEquals($fieldsData[0]->max_length, 11);
}

$this->assertNull($fieldsData[0]->default);
$this->assertNull($fieldsData[1]->default);
Expand Down

0 comments on commit f925658

Please sign in to comment.