3 namespace spec\Drupal\DrupalExtension\Context\Initializer;
5 use Behat\Behat\Context\Context;
7 use Drupal\DrupalDriverManager;
8 use Drupal\DrupalExtension\Context\DrupalAwareInterface;
10 use Behat\Testwork\Call\CallCenter;
11 use Behat\Testwork\Environment\EnvironmentManager;
12 use Behat\Testwork\Hook\HookDispatcher;
13 use Behat\Testwork\Hook\HookRepository;
15 use PhpSpec\ObjectBehavior;
16 use Prophecy\Argument;
18 class DrupalAwareInitializerSpec extends ObjectBehavior
22 function let(DrupalDriverManager $drupal)
24 $callCenter = new CallCenter();
25 $manager = new EnvironmentManager();
26 $repository = new HookRepository($manager);
27 // Cannot mock this class as it is marked as final.
28 $this->dispatcher = new HookDispatcher($repository, $callCenter);
29 $this->beConstructedWith($drupal, array(), $this->dispatcher);
32 function it_is_a_context_initializer()
34 $this->shouldHaveType('Behat\Behat\Context\Initializer\ContextInitializer');
37 function it_does_nothing_for_basic_contexts(Context $context)
39 $this->initializeContext($context);
42 function it_injects_drupal_and_parameters_and_dispatcher_in_drupal_aware_Contexts(DrupalAwareInterface $context, $drupal)
44 $context->setDispatcher($this->dispatcher)->shouldBeCAlled();
45 $context->setDrupal($drupal)->shouldBeCAlled();
46 $context->setDrupalParameters(array())->shouldBeCAlled();
47 $this->initializeContext($context);