Skip to content

Commit

Permalink
Change $this to self in generate-tests.php for method `assertStri…
Browse files Browse the repository at this point in the history
…ngEqualsFile` in TaskTestCase

In the test assertions, `$this->assertStringEqualsFile` was replaced with `self::assertStringEqualsFile`. The change was necessary because the method `assertStringEqualsFile` is static. This ensures a more proper and standard use of static method invocation in PHP.
  • Loading branch information
Theo D committed Mar 1, 2024
1 parent 82f4710 commit 347583e
Show file tree
Hide file tree
Showing 59 changed files with 118 additions and 118 deletions.
4 changes: 2 additions & 2 deletions bin/generate-tests.php
Expand Up @@ -167,9 +167,9 @@ public function test(): void
$process = $this->runTask([{{ args }}]{{ cwd }});

$this->assertSame({{ exitCode }}, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/ArgsAnotherArgsTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['args:another-args', 'FIXME(required)', '--test2', 1]);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/ArgsArgsTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['args:args', 'FIXME(word)', '--option', 'default value', '--dry-run']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/BarBarTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['bar:bar']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/CacheComplexTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['cache:complex']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/CacheSimpleTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['cache:simple']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/ContextContextDoNotExistTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['context:context', '--context', 'no_no_exist']);

$this->assertSame(1, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/ContextContextDynamicTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['context:context', '--context', 'dynamic']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/ContextContextInfoForcedTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['context:context-info-forced']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/ContextContextMyDefaultTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['context:context', '--context', 'my_default', '-v']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/ContextContextPathTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['context:context', '--context', 'path']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/ContextContextProductionTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['context:context', '--context', 'production']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/ContextContextRunTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['context:context', '--context', 'run']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/ContextContextTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['context:context']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/ContextContextWithTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['context:context-with']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/EnabledInProduction.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['enabled:hello', '--context', 'production']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/EnvEnvTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['env:env']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/EventListenerMyTaskTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['event-listener:my-task']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/FailureAllowFailureTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['failure:allow-failure']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/FailureFailureTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['failure:failure']);

$this->assertSame(1, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/FilesystemFilesystemTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['filesystem:filesystem']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/FilesystemFindTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['filesystem:find']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/FooBarTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['foo:bar']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/FooFooTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['foo:foo']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/HelloTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['hello']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/HttpRequestTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['http-request']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/ListTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['list', '--raw', '--format', 'txt', '--short']);

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/NewProjectInitTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['init'], '/tmp');

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/NewProjectTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask([], '/tmp');

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Examples/Generated/NoConfigCompletionTest.php
Expand Up @@ -12,9 +12,9 @@ public function test(): void
$process = $this->runTask(['completion', 'bash'], '/tmp');

$this->assertSame(0, $process->getExitCode());
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
self::assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput());
if (file_exists(__FILE__ . '.err.txt')) {
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
self::assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput());
} else {
$this->assertSame('', $process->getErrorOutput());
}
Expand Down

0 comments on commit 347583e

Please sign in to comment.