Skip to content

Commit a7e6f2b

Browse files
committed
Fix tests.
1 parent 20d3888 commit a7e6f2b

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

tests/framework/db/mysql/SchemaTest.php

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function constraintsProvider()
7474
$result = parent::constraintsProvider();
7575

7676
$result['1: check'][2][0]->columnNames = null;
77-
$result['1: check'][2][0]->expression = "(`C_check` <> _utf8mb4\\'\\')";
77+
$result['1: check'][2][0]->expression = "`C_check` <> ''";
7878
$result['2: primary key'][2]->name = null;
7979

8080
// Work aroung bug in MySQL 5.1 - it creates only this table in lowercase. O_o
@@ -95,6 +95,17 @@ public function testTableSchemaConstraints($tableName, $type, $expected): void
9595
$this->expectException('yii\base\NotSupportedException');
9696
}
9797

98+
$version = $this->getConnection(false)->getServerVersion();
99+
100+
if (
101+
\stripos($version, 'MariaDb') === false &&
102+
version_compare($version, '8.0.16', '>=') &&
103+
$tableName === 'T_constraints_1' &&
104+
$type === 'checks'
105+
) {
106+
$expected[0]->expression = "(`C_check` <> _utf8mb4\\'\\')";
107+
}
108+
98109
$constraints = $this->getConnection(false)->getSchema()->{'getTable' . ucfirst($type)}($tableName);
99110
$this->assertMetadataEquals($expected, $constraints);
100111
}
@@ -111,6 +122,17 @@ public function testTableSchemaConstraintsWithPdoUppercase($tableName, $type, $e
111122
$this->expectException('yii\base\NotSupportedException');
112123
}
113124

125+
$version = $this->getConnection(false)->getServerVersion();
126+
127+
if (
128+
\stripos($version, 'MariaDb') === false &&
129+
version_compare($version, '8.0.16', '>=') &&
130+
$tableName === 'T_constraints_1' &&
131+
$type === 'checks'
132+
) {
133+
$expected[0]->expression = "(`C_check` <> _utf8mb4\\'\\')";
134+
}
135+
114136
$connection = $this->getConnection(false);
115137
$connection->getSlavePdo(true)->setAttribute(\PDO::ATTR_CASE, \PDO::CASE_UPPER);
116138
$constraints = $connection->getSchema()->{'getTable' . ucfirst($type)}($tableName, true);
@@ -129,6 +151,17 @@ public function testTableSchemaConstraintsWithPdoLowercase($tableName, $type, $e
129151
$this->expectException('yii\base\NotSupportedException');
130152
}
131153

154+
$version = $this->getConnection(false)->getServerVersion();
155+
156+
if (
157+
\stripos($version, 'MariaDb') === false &&
158+
version_compare($version, '8.0.16', '>=') &&
159+
$tableName === 'T_constraints_1' &&
160+
$type === 'checks'
161+
) {
162+
$expected[0]->expression = "(`C_check` <> _utf8mb4\\'\\')";
163+
}
164+
132165
$connection = $this->getConnection(false);
133166
$connection->getSlavePdo(true)->setAttribute(\PDO::ATTR_CASE, \PDO::CASE_LOWER);
134167
$constraints = $connection->getSchema()->{'getTable' . ucfirst($type)}($tableName, true);

tests/framework/validators/FileValidatorTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,11 @@ public function validMimeTypes()
572572
]);
573573

574574
# fix for bundled libmagic bug, see also https://github.com/yiisoft/yii2/issues/19925
575-
$v81_zx = ['test.tar.xz', 'application/octet-stream', 'tar.xz'];
576-
array_pop($validMimeTypes);
577-
$validMimeTypes[] = $v81_zx;
575+
if ((PHP_VERSION_ID >= 80100 && PHP_VERSION_ID < 80122) || (PHP_VERSION_ID >= 80200 && PHP_VERSION_ID < 80209)) {
576+
$v81_zx = ['test.tar.xz', 'application/octet-stream', 'tar.xz'];
577+
array_pop($validMimeTypes);
578+
$validMimeTypes[] = $v81_zx;
579+
}
578580

579581
return $validMimeTypes;
580582
}

0 commit comments

Comments
 (0)