Skip to content

Commit 561971c

Browse files
committed
Fix ShowTableInfoTest to pass on Windows
1 parent a9859e8 commit 561971c

File tree

1 file changed

+47
-49
lines changed

1 file changed

+47
-49
lines changed

tests/system/Commands/Database/ShowTableInfoTest.php

Lines changed: 47 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ public function testDbTable(): void
6464
$expected = 'Data of Table "db_migrations":';
6565
$this->assertStringContainsString($expected, $result);
6666

67-
$expected = <<<'EOL'
68-
+----+----------------+--------------------+-------+---------------+------------+-------+
69-
| id | version | class | group | namespace | time | batch |
70-
+----+----------------+--------------------+-------+---------------+------------+-------+
71-
EOL;
67+
$expected = implode(PHP_EOL, [
68+
'+----+----------------+--------------------+-------+---------------+------------+-------+',
69+
'| id | version | class | group | namespace | time | batch |',
70+
'+----+----------------+--------------------+-------+---------------+------------+-------+',
71+
]);
7272
$this->assertStringContainsString($expected, $result);
7373
}
7474

@@ -81,11 +81,11 @@ public function testDbTableShow(): void
8181
$expected = 'The following is a list of the names of all database tables:';
8282
$this->assertStringContainsString($expected, $result);
8383

84-
$expected = <<<'EOL'
85-
+----+---------------------------+-------------+---------------+
86-
| ID | Table Name | Num of Rows | Num of Fields |
87-
+----+---------------------------+-------------+---------------+
88-
EOL;
84+
$expected = implode(PHP_EOL, [
85+
'+----+---------------------------+-------------+---------------+',
86+
'| ID | Table Name | Num of Rows | Num of Fields |',
87+
'+----+---------------------------+-------------+---------------+',
88+
]);
8989
$this->assertStringContainsString($expected, $result);
9090
}
9191

@@ -99,9 +99,7 @@ public function testDbTableMetadata(): void
9999
$this->assertStringContainsString($expected, $result);
100100

101101
$result = preg_replace('/\s+/', ' ', $result);
102-
$expected = <<<'EOL'
103-
| Field Name | Type | Max Length | Nullable | Default | Primary Key |
104-
EOL;
102+
$expected = '| Field Name | Type | Max Length | Nullable | Default | Primary Key |';
105103
$this->assertStringContainsString($expected, $result);
106104
}
107105

@@ -117,16 +115,16 @@ public function testDbTableDesc(): void
117115
$expected = 'Data of Table "db_user":';
118116
$this->assertStringContainsString($expected, $result);
119117

120-
$expected = <<<'EOL'
121-
+----+--------------------+--------------------+---------+------------+------------+------------+
122-
| id | name | email | country | created_at | updated_at | deleted_at |
123-
+----+--------------------+--------------------+---------+------------+------------+------------+
124-
| 4 | Chris Martin | [email protected] | UK | | | |
125-
| 3 | Richard A Cause... | [email protected]... | US | | | |
126-
| 2 | Ahmadinejad | ahmadinejad@wor... | Iran | | | |
127-
| 1 | Derek Jones | [email protected] | US | | | |
128-
+----+--------------------+--------------------+---------+------------+------------+------------+
129-
EOL;
118+
$expected = implode(PHP_EOL, [
119+
'+----+--------------------+--------------------+---------+------------+------------+------------+',
120+
'| id | name | email | country | created_at | updated_at | deleted_at |',
121+
'+----+--------------------+--------------------+---------+------------+------------+------------+',
122+
'| 4 | Chris Martin | [email protected] | UK | | | |',
123+
'| 3 | Richard A Cause... | [email protected]... | US | | | |',
124+
'| 2 | Ahmadinejad | ahmadinejad@wor... | Iran | | | |',
125+
'| 1 | Derek Jones | [email protected] | US | | | |',
126+
'+----+--------------------+--------------------+---------+------------+------------+------------+',
127+
]);
130128
$this->assertStringContainsString($expected, $result);
131129
}
132130

@@ -139,16 +137,16 @@ public function testDbTableLimitFieldValueLength(): void
139137
$expected = 'Data of Table "db_user":';
140138
$this->assertStringContainsString($expected, $result);
141139

142-
$expected = <<<'EOL'
143-
+----+----------+----------+---------+------------+------------+------------+
144-
| id | name | email | country | created_at | updated_at | deleted_at |
145-
+----+----------+----------+---------+------------+------------+------------+
146-
| 1 | Derek... | derek... | US | | | |
147-
| 2 | Ahmad... | ahmad... | Iran | | | |
148-
| 3 | Richa... | richa... | US | | | |
149-
| 4 | Chris... | chris... | UK | | | |
150-
+----+----------+----------+---------+------------+------------+------------+
151-
EOL;
140+
$expected = implode(PHP_EOL, [
141+
'+----+----------+----------+---------+------------+------------+------------+',
142+
'| id | name | email | country | created_at | updated_at | deleted_at |',
143+
'+----+----------+----------+---------+------------+------------+------------+',
144+
'| 1 | Derek... | derek... | US | | | |',
145+
'| 2 | Ahmad... | ahmad... | Iran | | | |',
146+
'| 3 | Richa... | richa... | US | | | |',
147+
'| 4 | Chris... | chris... | UK | | | |',
148+
'+----+----------+----------+---------+------------+------------+------------+',
149+
]);
152150
$this->assertStringContainsString($expected, $result);
153151
}
154152

@@ -161,14 +159,14 @@ public function testDbTableLimitRows(): void
161159
$expected = 'Data of Table "db_user":';
162160
$this->assertStringContainsString($expected, $result);
163161

164-
$expected = <<<'EOL'
165-
+----+-------------+--------------------+---------+------------+------------+------------+
166-
| id | name | email | country | created_at | updated_at | deleted_at |
167-
+----+-------------+--------------------+---------+------------+------------+------------+
168-
| 1 | Derek Jones | [email protected] | US | | | |
169-
| 2 | Ahmadinejad | ahmadinejad@wor... | Iran | | | |
170-
+----+-------------+--------------------+---------+------------+------------+------------+
171-
EOL;
162+
$expected = implode(PHP_EOL, [
163+
'+----+-------------+--------------------+---------+------------+------------+------------+',
164+
'| id | name | email | country | created_at | updated_at | deleted_at |',
165+
'+----+-------------+--------------------+---------+------------+------------+------------+',
166+
'| 1 | Derek Jones | [email protected] | US | | | |',
167+
'| 2 | Ahmadinejad | ahmadinejad@wor... | Iran | | | |',
168+
'+----+-------------+--------------------+---------+------------+------------+------------+',
169+
]);
172170
$this->assertStringContainsString($expected, $result);
173171
}
174172

@@ -181,14 +179,14 @@ public function testDbTableAllOptions(): void
181179
$expected = 'Data of Table "db_user":';
182180
$this->assertStringContainsString($expected, $result);
183181

184-
$expected = <<<'EOL'
185-
+----+----------+----------+---------+------------+------------+------------+
186-
| id | name | email | country | created_at | updated_at | deleted_at |
187-
+----+----------+----------+---------+------------+------------+------------+
188-
| 4 | Chris... | chris... | UK | | | |
189-
| 3 | Richa... | richa... | US | | | |
190-
+----+----------+----------+---------+------------+------------+------------+
191-
EOL;
182+
$expected = implode(PHP_EOL, [
183+
'+----+----------+----------+---------+------------+------------+------------+',
184+
'| id | name | email | country | created_at | updated_at | deleted_at |',
185+
'+----+----------+----------+---------+------------+------------+------------+',
186+
'| 4 | Chris... | chris... | UK | | | |',
187+
'| 3 | Richa... | richa... | US | | | |',
188+
'+----+----------+----------+---------+------------+------------+------------+',
189+
]);
192190
$this->assertStringContainsString($expected, $result);
193191
}
194192
}

0 commit comments

Comments
 (0)