Skip to content

Commit

Permalink
code-style
Browse files Browse the repository at this point in the history
  • Loading branch information
TitasGailius committed Nov 24, 2020
1 parent 6bc03e3 commit 9adcce0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/Fakes/BuilderFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,6 @@ public static function assertExecuted($command, int $times = 1)
*/
public static function assertNotExecuted($command)
{
self::assertExecuted($command, 0);
static::assertExecuted($command, 0);
}
}
29 changes: 10 additions & 19 deletions tests/FakeTerminalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,14 @@ public function testAssertNotExecuted()
{
Terminal::fake();

Terminal::assertNotExecuted($expected = 'echo "Hello, World"');
Terminal::assertNotExecuted($command = 'echo "Hello, World"');

Terminal::execute($expected);
Terminal::execute($command);

$this->expectException(ExpectationFailedException::class);
Terminal::assertNotExecuted($expected = 'echo "Hello, World"');
Terminal::assertNotExecuted($command = 'echo "Hello, World"');
}

/**
* Test that Terminal can capture and assert executions using a custom filter.
*
* @return void
*/
public function testCaptureAndAssertExecutedUsingCustomFilter()
{
Terminal::fake();
Expand All @@ -74,26 +69,22 @@ public function testCaptureAndAssertExecutedUsingCustomFilter()
});
}

/**
* Test that Terminal can assert that a given command was not executed using a custom filter.
*
* @return void
*/
public function testAssertNotExecutedUsingCustomFilter()
{
Terminal::fake();

$expected = 'echo "Hello, World"';
$command = 'echo "Hello, World"';

Terminal::assertNotExecuted(function ($captured) use ($expected) {
return $captured->toString() == $expected;
Terminal::assertNotExecuted(function ($captured) use ($command) {
return $captured->toString() == $command;
});

Terminal::execute($expected);
Terminal::execute($command);

$this->expectException(ExpectationFailedException::class);
Terminal::assertNotExecuted(function ($captured) use ($expected) {
return $captured->toString() == $expected;

Terminal::assertNotExecuted(function ($captured) use ($command) {
return $captured->toString() == $command;
});
}

Expand Down

0 comments on commit 9adcce0

Please sign in to comment.