Skip to content

Commit fdad751

Browse files
committed
Turn all QA checks green
1 parent b4eaeb1 commit fdad751

File tree

3 files changed

+16
-37
lines changed

3 files changed

+16
-37
lines changed

etc/qa/phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ parameters:
1313

1414
includes:
1515
- ../../extension.neon
16-
16+
- phar://phpstan.phar/conf/bleedingEdge.neon

extension.neon

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ parameters:
33
noExtends:
44
classesAllowedToBeExtended:
55
- WyriHaximus\TestUtilities\TestCase
6-
7-
includes:
8-
- phar://phpstan.phar/conf/bleedingEdge.neon

tests/TestCaseTest.php

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44

55
namespace WyriHaximus\Tests\TestUtilities;
66

7+
use PHPUnit\Framework\Attributes\DataProvider;
78
use PHPUnit\Framework\Attributes\Test;
8-
use RuntimeException;
99
use WyriHaximus\TestUtilities\TestCase;
1010

11-
use function chmod;
1211
use function func_get_args;
1312
use function random_int;
1413
use function Safe\file_get_contents;
@@ -19,7 +18,6 @@
1918
use function substr;
2019
use function sys_get_temp_dir;
2120
use function time;
22-
use function touch;
2321
use function uniqid;
2422

2523
use const DIRECTORY_SEPARATOR;
@@ -55,12 +53,14 @@ public static function provideTemporaryDirectory(): iterable
5553
}
5654
}
5755

58-
public function testRecursiveDirectoryCreation(): void
56+
#[Test]
57+
public function recursiveDirectoryCreation(): void
5958
{
6059
static::assertFileExists($this->getTmpDir());
6160
}
6261

63-
/** @dataProvider provideTemporaryDirectory */
62+
#[Test]
63+
#[DataProvider('provideTemporaryDirectory')]
6464
public function testTemporaryDirectoryAndGetFilesInDirectory(string $int): void
6565
{
6666
static::assertTrue(strtoupper(substr(PHP_OS, TestCase::WIN_START, TestCase::WIN_END)) === 'WIN' ? strpos(TestCase::WINDOWS_TEMP_DIR_PREFIX, sys_get_temp_dir()) === 0 : strpos($this->getTmpDir(), sys_get_temp_dir()) === 0);
@@ -81,12 +81,14 @@ public function testTemporaryDirectoryAndGetFilesInDirectory(string $int): void
8181
}
8282
}
8383

84-
/** @dataProvider provideTrueFalse */
85-
public function testTrueOrFalse(bool $bool): void
84+
#[Test]
85+
#[DataProvider('provideTrueFalse')]
86+
public function trueOrFalse(bool $bool): void
8687
{
8788
static::assertCount(1, func_get_args());
8889
}
8990

91+
#[Test]
9092
public function testTrueAndFalse(): void
9193
{
9294
static::assertSame(
@@ -95,53 +97,33 @@ public function testTrueAndFalse(): void
9597
);
9698
}
9799

98-
public function testGetSysTempDir(): void
100+
#[Test]
101+
public function successGetSysTempDir(): void
99102
{
100103
self::assertFileExists($this->getSysTempDir());
101104
}
102105

103-
public function testWaitUntilTheNextSecond(): void
106+
#[Test]
107+
public function successWaitUntilTheNextSecond(): void
104108
{
105109
$now = time();
106110
static::waitUntilTheNextSecond();
107111
self::assertSame($now + 1, time());
108112
}
109113

110-
public function testRmDir(): void
111-
{
112-
$tmpDir = $this->getSysTempDir() .
113-
DIRECTORY_SEPARATOR .
114-
'p-a-c-t-' .
115-
uniqid() .
116-
DIRECTORY_SEPARATOR;
117-
118-
mkdir($tmpDir);
119-
120-
self::assertDirectoryExists($tmpDir);
121-
$this->rmdir($tmpDir);
122-
self::assertDirectoryDoesNotExist($tmpDir);
123-
}
124-
125114
#[Test]
126-
public function failRmDir(): void
115+
public function successRmDir(): void
127116
{
128117
$tmpDir = $this->getSysTempDir() .
129118
DIRECTORY_SEPARATOR .
130119
'p-a-c-t-' .
131120
uniqid() .
132121
DIRECTORY_SEPARATOR;
133122

134-
self::expectException(RuntimeException::class);
135-
self::expectExceptionMessage('Error deleting directory: ' . $tmpDir . ' with error: rmdir(' . $tmpDir . '): Directory not empty');
136-
137123
mkdir($tmpDir);
138-
touch($tmpDir . '__FILE__');
139124

140125
self::assertDirectoryExists($tmpDir);
141-
self::assertFileExists($tmpDir . '__FILE__');
142-
143-
chmod($tmpDir, 0444);
144-
145126
$this->rmdir($tmpDir);
127+
self::assertDirectoryDoesNotExist($tmpDir);
146128
}
147129
}

0 commit comments

Comments
 (0)