Last active
February 8, 2018 14:26
-
-
Save arnolanglade/4ca0bedbcf41356a112a to your computer and use it in GitHub Desktop.
PhpSpec Symfony command template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\DependencyInjection\ContainerInterface; | |
class CommandSpec extends ObjectBehavior | |
{ | |
function it_has_a_name() | |
{ | |
$this->getName()->shouldReturn('name:command'); | |
} | |
function it_is_a_container_aware_command() | |
{ | |
$this->shouldHaveType('Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand'); | |
} | |
function it_do_something( | |
ContainerInterface $container, | |
InputInterface $input, | |
OutputInterface $output | |
) { | |
// With options | |
$input->bind(Argument::any())->shouldBeCalled(); | |
$input->isInteractive()->shouldBeCalled(); | |
$input->validate()->shouldBeCalled(); | |
$this->setContainer($container); | |
$this->run($input, $output); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment