Skip to content

Commit

Permalink
fixup! Apply coding standard
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelstolt committed Nov 8, 2023
1 parent 046bc97 commit 50950e6
Showing 1 changed file with 44 additions and 45 deletions.
@@ -1,45 +1,44 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Console\Tests\Tester\Constraint;

use PHPUnit\Framework\ExpectationFailedException;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\TestFailure;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Tester\Constraint\CommandIsFaulty;

final class CommandIsFaultyTest extends TestCase
{
public function testConstraint()
{
$constraint = new CommandIsFaulty();

$this->assertFalse($constraint->evaluate(Command::SUCCESS, returnResult: true));
$this->assertTrue($constraint->evaluate(Command::FAILURE, returnResult: true));
$this->assertTrue($constraint->evaluate(Command::INVALID, returnResult: true));
}

public function testSuccessfulCommand()
{
$constraint = new CommandIsFaulty();

try {
$constraint->evaluate(Command::SUCCESS);
} catch (ExpectationFailedException $e) {
$this->assertStringContainsString('Failed asserting that the command is faulty.', $e->getMessage());

return;
}

$this->fail();
}
}
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Console\Tests\Tester\Constraint;

use PHPUnit\Framework\ExpectationFailedException;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Tester\Constraint\CommandIsFaulty;

final class CommandIsFaultyTest extends TestCase
{
public function testConstraint()
{
$constraint = new CommandIsFaulty();

$this->assertFalse($constraint->evaluate(Command::SUCCESS, returnResult: true));
$this->assertTrue($constraint->evaluate(Command::FAILURE, returnResult: true));
$this->assertTrue($constraint->evaluate(Command::INVALID, returnResult: true));
}

public function testSuccessfulCommand()
{
$constraint = new CommandIsFaulty();

try {
$constraint->evaluate(Command::SUCCESS);
} catch (ExpectationFailedException $e) {
$this->assertStringContainsString('Failed asserting that the command is faulty.', $e->getMessage());

return;
}

$this->fail();
}
}

0 comments on commit 50950e6

Please sign in to comment.