Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change $this to self in generate-tests.php for method assertStringEqualsFile in TaskTestCase #304

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion src/Attribute/AsCommandArgument.php
Expand Up @@ -5,7 +5,7 @@
abstract class AsCommandArgument
{
public function __construct(
public readonly string|null $name = null,
public readonly ?string $name = null,
) {
}
}
2 changes: 1 addition & 1 deletion src/Attribute/AsOption.php
Expand Up @@ -12,7 +12,7 @@ class AsOption extends AsCommandArgument
public function __construct(
?string $name = null,
public readonly string|array|null $shortcut = null,
public readonly int|null $mode = null,
public readonly ?int $mode = null,
public readonly string $description = '',
public readonly array $suggestedValues = [],
) {
Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/AsTask.php
Expand Up @@ -11,7 +11,7 @@ class AsTask
*/
public function __construct(
public string $name = '',
public string|null $namespace = null,
public ?string $namespace = null,
public string $description = '',
public array $aliases = [],
public array $onSignals = [],
Expand Down
4 changes: 2 additions & 2 deletions src/Context.php
Expand Up @@ -17,7 +17,7 @@ public function __construct(
?string $currentDirectory = null,
public readonly bool $tty = false,
public readonly bool $pty = true,
public readonly float|null $timeout = null,
public readonly ?float $timeout = null,
public readonly bool $quiet = false,
public readonly bool $allowFailure = false,
public readonly bool $notify = false,
Expand Down Expand Up @@ -132,7 +132,7 @@ public function withPty(bool $pty = true): self
);
}

public function withTimeout(float|null $timeout): self
public function withTimeout(?float $timeout): self
{
return new self(
$this->data,
Expand Down
2 changes: 1 addition & 1 deletion src/SectionOutput.php
Expand Up @@ -14,7 +14,7 @@ class SectionOutput

private OutputInterface|ConsoleSectionOutput $consoleOutput;

private ConsoleOutput|null $mainOutput;
private ?ConsoleOutput $mainOutput;

/** @var \SplObjectStorage<Process, SectionDetails> */
private \SplObjectStorage $sections;
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