Skip to content

Commit ba65247

Browse files
committed
Test housecleaning
1 parent 1ca4b29 commit ba65247

File tree

8 files changed

+360
-301
lines changed

8 files changed

+360
-301
lines changed

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/.github export-ignore
2+
/tests export-ignore
3+
4+
.gitattributes export-ignore
5+
.gitignore export-ignore
6+
.gitlab-ci.yml export-ignore
7+
captainhook.json export-ignore

.gitlab-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ test_phpunit:
1212
stage: test
1313
script:
1414
- composer install
15-
- vendor/bin/phpunit tests
15+
- composer test
1616

1717
test_quality:
1818
stage: test
1919
script:
2020
- composer install
2121
- vendor/bin/phpcs --standard=PSR12 -n src
22-
- vendor/bin/phpstan analyse src --level=9
22+
- composer check-static

captainhook.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33
"enabled": true,
44
"actions": [
55
{
6-
"action": "vendor/bin/phpcbf --standard=PSR12 src",
7-
"options": []
8-
},
6+
"action": "composer format"
7+
}
8+
]
9+
},
10+
"pre-push": {
11+
"enabled": true,
12+
"actions": [
913
{
10-
"action": "vendor/bin/phpunit tests",
11-
"options": []
14+
"action": "composer check-static"
1215
},
1316
{
14-
"action": "vendor/bin/phpstan analyze src --level=9",
15-
"options": []
17+
"action": "composer test"
1618
}
1719
]
1820
}

composer.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@
2727
"monolog/monolog": "2.*",
2828
"phpstan/phpstan": "^1.10",
2929
"captainhook/captainhook": "^5.16",
30-
"squizlabs/php_codesniffer": "^3.7"
30+
"phpcsstandards/php_codesniffer": "^3.7"
31+
},
32+
"scripts": {
33+
"check-static": "phpstan analyse src --level=9",
34+
"format": "phpcbf --standard=PSR12 src tests",
35+
"test": "phpunit tests",
36+
"post-autoload-dump": [
37+
"vendor/bin/captainhook install -f -s"
38+
]
3139
}
3240
}

composer.lock

Lines changed: 59 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/LogRecordTest.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
use PHPUnit\Framework\TestCase;
44
use Devdot\Monolog\LogRecord;
55

6-
final class LogRecordTest extends TestCase {
7-
public function testConstruct() {
6+
final class LogRecordTest extends TestCase
7+
{
8+
public function testConstruct()
9+
{
810
$record = new LogRecord(
911
new \DateTimeImmutable('2023-01-02 08:00:01'),
1012
'test-channel',
@@ -24,7 +26,8 @@ public function testConstruct() {
2426
$this->assertCount(0, $record->extra);
2527
}
2628

27-
public function testArrayAccess() {
29+
public function testArrayAccess()
30+
{
2831
$record = new LogRecord(
2932
new \DateTimeImmutable('2023-01-02 08:00:01'),
3033
'test-channel',
@@ -36,23 +39,21 @@ public function testArrayAccess() {
3639
$this->assertIsObject($record);
3740
$this->assertIsNotArray($record);
3841

39-
// make sure we can read
42+
// make sure we can read
4043
$this->assertIsObject($record['datetime']);
4144
$this->assertIsString($record['channel']);
42-
45+
4346
// make sure we can't write or unset
4447
try {
4548
$record['level'] = 'test';
4649
throw new \Exception();
47-
}
48-
catch(\Exception $e) {
50+
} catch (\Exception $e) {
4951
$this->assertInstanceOf(\LogicException::class, $e);
5052
}
5153
try {
5254
unset($record['message']);
5355
throw new \Exception();
54-
}
55-
catch(\Exception $e) {
56+
} catch (\Exception $e) {
5657
$this->assertInstanceOf(\LogicException::class, $e);
5758
}
5859
}

0 commit comments

Comments
 (0)