Skip to content

Commit 6c49b7f

Browse files
committed
Use phpunit 7+.
1 parent db946e2 commit 6c49b7f

File tree

25 files changed

+112
-75
lines changed

25 files changed

+112
-75
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/.idea/
2+
/.phpunit.result.cache
23
/bin/phing
34
/bin/phpunit
45
/bin/stratum

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
"symfony/console": "^3.0.0 || ^4.0.0"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "^6.0.0",
19+
"ext-pcntl": "*",
20+
"ext-posix": "*",
21+
"phpunit/phpunit": "^7.0.0 || ^8.0.0",
2022
"phing/phing": "^2.0.0"
2123
},
2224
"autoload": {
@@ -33,6 +35,6 @@
3335
"bin/audit"
3436
],
3537
"config": {
36-
"bin-dir": "bin"
38+
"bin-dir": "bin/"
3739
}
3840
}

test/MySql/AlterAuditTableCommand/AlterAuditTableCommandTest.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
declare(strict_types=1);
23

34
namespace SetBased\Audit\Test\MySql\AlterAuditTableCommand;
45

@@ -18,7 +19,7 @@ class AlterAuditTableCommandTest extends AuditTestCase
1819
/**
1920
* @inheritdoc
2021
*/
21-
public function setUp()
22+
public function setUp(): void
2223
{
2324
parent::setUp();
2425

@@ -31,7 +32,7 @@ public function setUp()
3132
/**
3233
* Test default character set has changed.
3334
*/
34-
public function testCharset()
35+
public function testCharset(): void
3536
{
3637
$this->base('testCharset');
3738
}
@@ -40,7 +41,7 @@ public function testCharset()
4041
/**
4142
* Test default collation has changed.
4243
*/
43-
public function testCollation()
44+
public function testCollation(): void
4445
{
4546
$this->base('testCollation');
4647
}
@@ -49,7 +50,7 @@ public function testCollation()
4950
/**
5051
* Test engine has changed,
5152
*/
52-
public function testEngine()
53+
public function testEngine(): void
5354
{
5455
$this->base('testEngine');
5556
}
@@ -58,7 +59,7 @@ public function testEngine()
5859
/**
5960
* Test from 'int(11)' to 'int(8)'.
6061
*/
61-
public function testIntColumn()
62+
public function testIntColumn(): void
6263
{
6364
$this->base('testIntColumn');
6465
}
@@ -67,7 +68,7 @@ public function testIntColumn()
6768
/**
6869
* Test with many changes.
6970
*/
70-
public function testMany()
71+
public function testMany(): void
7172
{
7273
$this->base('testMany');
7374
}
@@ -76,7 +77,7 @@ public function testMany()
7677
/**
7778
* Test multiple columns changed.
7879
*/
79-
public function testMultipleColumns()
80+
public function testMultipleColumns(): void
8081
{
8182
$this->base('testMultipleColumns');
8283
}
@@ -85,7 +86,7 @@ public function testMultipleColumns()
8586
/**
8687
* Test from 'datetime' to 'timestamp'.
8788
*/
88-
public function testTimestampColumn()
89+
public function testTimestampColumn(): void
8990
{
9091
$this->base('testTimestampColumn');
9192
}
@@ -94,7 +95,7 @@ public function testTimestampColumn()
9495
/**
9596
* Test from 'varchar(10) utf8' to 'varchar(10) ascii collate ascii_bin' (same length different charset and collate).
9697
*/
97-
public function testVarcharColumn()
98+
public function testVarcharColumn(): void
9899
{
99100
$this->base('testVarcharColumn');
100101
}
@@ -106,7 +107,7 @@ public function testVarcharColumn()
106107
* @param int $statusCode The expected status code of the command.
107108
* @param bool $rewriteConfigFile If true the config file will be rewritten.
108109
*/
109-
protected function runAlter($statusCode = 0, $rewriteConfigFile = false)
110+
protected function runAlter(int $statusCode = 0, bool $rewriteConfigFile = false): void
110111
{
111112
$application = new Application();
112113
$application->add(new AlterAuditTableCommand());
@@ -129,7 +130,7 @@ protected function runAlter($statusCode = 0, $rewriteConfigFile = false)
129130
/**
130131
* Runs the audit command, i.e. creates the audit table.
131132
*/
132-
protected function runAudit()
133+
protected function runAudit(): void
133134
{
134135
$application = new Application();
135136
$application->add(new AuditCommand());
@@ -151,7 +152,7 @@ protected function runAudit()
151152
*
152153
* @param string $name The name of the test.
153154
*/
154-
private function base($name)
155+
private function base(string $name): void
155156
{
156157
// Run audit.
157158
$this->runAudit();

test/MySql/AuditCommand/AbcFramework/AbcFrameworkTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
declare(strict_types=1);
23

34
namespace SetBased\Audit\Test\MySql\AuditCommand\AbcFramework;
45

@@ -14,7 +15,7 @@ class AbcFrameworkTest extends AuditCommandTestCase
1415
/**
1516
* Connects to the MySQL server.
1617
*/
17-
public static function setUpBeforeClass()
18+
public static function setUpBeforeClass(): void
1819
{
1920
self::$dir = __DIR__;
2021

@@ -25,7 +26,7 @@ public static function setUpBeforeClass()
2526
/**
2627
* Test audit table is created correctly.
2728
*/
28-
public function test01()
29+
public function test01(): void
2930
{
3031
$this->runAudit();
3132

@@ -125,7 +126,7 @@ public function test01()
125126
/**
126127
* Test insert trigger is working correctly.
127128
*/
128-
public function test02a()
129+
public function test02a(): void
129130
{
130131
// Insert a row into ABC_AUTH_COMPANY.
131132
$sql = sprintf('
@@ -170,7 +171,7 @@ public function test02a()
170171
/**
171172
* Test update trigger is working correctly.
172173
*/
173-
public function test02b()
174+
public function test02b(): void
174175
{
175176
// Set session and user ID.
176177
StaticDataLayer::executeNone('set @abc_g_ses_id=12345'); // The combination of my suitcase.
@@ -233,7 +234,7 @@ public function test02b()
233234
/**
234235
* Test delete trigger is working correctly.
235236
*/
236-
public function test02c()
237+
public function test02c(): void
237238
{
238239
StaticDataLayer::executeNone("SET time_zone = 'Europe/Amsterdam'");
239240

@@ -276,7 +277,7 @@ public function test02c()
276277
/**
277278
* Test total number of rows in audit table.
278279
*/
279-
public function test02d()
280+
public function test02d(): void
280281
{
281282
// Get all audit rows.
282283
$sql = sprintf("
@@ -293,7 +294,7 @@ public function test02d()
293294
/**
294295
* Does not disconnect and connect to the database because we need continues numbering of audit_uuid and audit_rownum.
295296
*/
296-
protected function setUp()
297+
protected function setUp(): void
297298
{
298299
// Nothing to do.
299300
}
@@ -302,7 +303,7 @@ protected function setUp()
302303
/**
303304
* Does not disconnect and connect to the database because we need continues numbering of audit_uuid and audit_rownum.
304305
*/
305-
protected function tearDown()
306+
protected function tearDown(): void
306307
{
307308
// Nothing to do.
308309
}

test/MySql/AuditCommand/AddColumn/AddColumnTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
declare(strict_types=1);
23

34
namespace SetBased\Audit\Test\MySql\AuditCommand\AddColumn;
45

@@ -15,15 +16,15 @@ class AddColumnTest extends AuditCommandTestCase
1516
/**
1617
* @inheritdoc
1718
*/
18-
public static function setUpBeforeClass()
19+
public static function setUpBeforeClass(): void
1920
{
2021
self::$dir = __DIR__;
2122

2223
parent::setUpBeforeClass();
2324
}
2425

2526
//--------------------------------------------------------------------------------------------------------------------
26-
public function test01()
27+
public function test01(): void
2728
{
2829
// Run audit.
2930
$this->runAudit();

test/MySql/AuditCommand/AuditCommandTestCase.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
declare(strict_types=1);
23

34
namespace SetBased\Audit\Test\MySql\AuditCommand;
45

@@ -25,7 +26,7 @@ class AuditCommandTestCase extends AuditTestCase
2526
/**
2627
* @inheritdoc
2728
*/
28-
public static function setUpBeforeClass()
29+
public static function setUpBeforeClass(): void
2930
{
3031
parent::setUpBeforeClass();
3132

@@ -42,7 +43,7 @@ public static function setUpBeforeClass()
4243
* @param int $statusCode The expected status code of the command.
4344
* @param bool $rewriteConfigFile If true the config file will be rewritten.
4445
*/
45-
protected function runAudit($statusCode = 0, $rewriteConfigFile = false)
46+
protected function runAudit(int $statusCode = 0, bool $rewriteConfigFile = false): void
4647
{
4748
$application = new Application();
4849
$application->add(new AuditCommand());

test/MySql/AuditCommand/DropColumn/DropColumnTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
declare(strict_types=1);
23

34
namespace SetBased\Audit\Test\MySql\AuditCommand\DropColumn;
45

@@ -15,15 +16,15 @@ class DropColumnTest extends AuditCommandTestCase
1516
/**
1617
* @inheritdoc
1718
*/
18-
public static function setUpBeforeClass()
19+
public static function setUpBeforeClass(): void
1920
{
2021
self::$dir = __DIR__;
2122

2223
parent::setUpBeforeClass();
2324
}
2425

2526
//--------------------------------------------------------------------------------------------------------------------
26-
public function test01()
27+
public function test01(): void
2728
{
2829
// Run audit.
2930
$this->runAudit();

test/MySql/AuditCommand/LockTable/LockTableInnodbTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
declare(strict_types=1);
23

34
namespace SetBased\Audit\Test\MySql\AuditCommand\LockTable;
45

@@ -14,7 +15,7 @@ class LockTableInnodbTest extends LockTableTestCase
1415
* @inheritdoc
1516
*
1617
*/
17-
public static function setUpBeforeClass()
18+
public static function setUpBeforeClass(): void
1819
{
1920
parent::setUpBeforeClass();
2021

test/MySql/AuditCommand/LockTable/LockTableMemoryTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
declare(strict_types=1);
23

34
namespace SetBased\Audit\Test\MySql\AuditCommand\LockTable;
45

@@ -14,7 +15,7 @@ class LockTableMemoryTest extends LockTableTestCase
1415
* @inheritdoc
1516
*
1617
*/
17-
public static function setUpBeforeClass()
18+
public static function setUpBeforeClass(): void
1819
{
1920
parent::setUpBeforeClass();
2021

test/MySql/AuditCommand/LockTable/LockTableMyisamTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
declare(strict_types=1);
23

34
namespace SetBased\Audit\Test\MySql\AuditCommand\LockTable;
45

@@ -14,7 +15,7 @@ class LockTableMyisamTest extends LockTableTestCase
1415
* @inheritdoc
1516
*
1617
*/
17-
public static function setUpBeforeClass()
18+
public static function setUpBeforeClass(): void
1819
{
1920
parent::setUpBeforeClass();
2021

0 commit comments

Comments
 (0)