-
-
Save St0iK/72398539de0809c5c64975ce4bede603 to your computer and use it in GitHub Desktop.
PhpSpec Symfony command template
This file contains hidden or 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