Skip to content
This repository has been archived by the owner on Nov 29, 2017. It is now read-only.

Commit

Permalink
Merge pull request #14 from pskt/fix/kernel-driver-guard
Browse files Browse the repository at this point in the history
fix KernelDriver guard
  • Loading branch information
tyx committed Nov 23, 2015
2 parents 319aa3f + 6f4a47e commit a8c47dc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Mocker.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Rezzza\MockExtension;

use Behat\Mink\Mink;
use Behat\Symfony2Extension\Driver\KernelDriver;
use Symfony\Component\HttpKernel\KernelInterface;

class Mocker
Expand Down Expand Up @@ -46,9 +47,9 @@ private function isContainerBypassing()
return $this->container instanceof MockContainer;
}

private function isKernelDriverUsed($mink)
private function isKernelDriverUsed()
{
return 'symfony2' === $mink->getDefaultSessionName();
return $this->mink->getSession()->getDriver() instanceof KernelDriver;
}

private function guardAgainstContainerNotOverrided()
Expand All @@ -60,7 +61,7 @@ private function guardAgainstContainerNotOverrided()

private function guardAgainstKernelDriverNotUsed()
{
if ('symfony2' !== $this->mink->getDefaultSessionName()) {
if (!$this->isKernelDriverUsed()) {
throw new \LogicException('We can mock services only with symfony2 driver. Please use "@mink:symfony2" tag on scenario you want to be able to mock services');
}
}
Expand Down

0 comments on commit a8c47dc

Please sign in to comment.