Skip to content

Commit f6d1a3a

Browse files
committed
Fixed specs
1 parent 5003537 commit f6d1a3a

File tree

6 files changed

+23
-24
lines changed

6 files changed

+23
-24
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Changelog
44
dev-master
55
----------
66

7+
### BC Break
8+
9+
- [DoctrinePhpcrBundle] Shell must now be initiated in a different way in
10+
embedded mode. The DoctrinePhpcrBundle will need to be updated.
11+
712
### Bug fixes
813

914
- [config] Do not override CLI options with profile options

spec/PHPCR/Shell/Console/Application/EmbeddedApplicationSpec.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55
use PhpSpec\ObjectBehavior;
66
use PHPCR\Shell\Console\Application\EmbeddedApplication;
77
use Symfony\Component\DependencyInjection\ContainerInterface;
8+
use PHPCR\Shell\PhpcrShell;
9+
use PHPCR\Shell\DependencyInjection\Container;
810

911
class EmbeddedApplicationSpec extends ObjectBehavior
1012
{
1113
public function let(
12-
ContainerInterface $container
14+
Container $container
1315
)
1416
{
15-
$this->beConstructedWith($container, EmbeddedApplication::MODE_COMMAND);
17+
$this->beConstructedWith($container);
1618
}
1719

1820
public function it_is_initializable()

spec/PHPCR/Shell/Console/Application/ShellApplicationSpec.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
use PhpSpec\ObjectBehavior;
66
use Symfony\Component\DependencyInjection\ContainerInterface;
77
use PHPCR\Shell\Console\Application\EmbeddedApplication;
8+
use PHPCR\Shell\PhpcrShell;
89

910
class ShellApplicationSpec extends ObjectBehavior
1011
{
1112
public function let(
1213
ContainerInterface $container
1314
)
1415
{
15-
$this->beConstructedWith($container, EmbeddedApplication::MODE_COMMAND);
16+
$this->beConstructedWith($container, PhpcrShell::MODE_EMBEDDED_COMMAND);
1617
}
1718

1819
public function it_is_initializable()

src/PHPCR/Shell/Config/Config.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ public function offsetGet($offset)
3636
{
3737
if (isset($this->data[$offset])) {
3838
$value = $this->data[$offset];
39+
3940
if (is_array($value)) {
4041
return new self($value);
41-
} else {
42-
return $value;
4342
}
43+
44+
return $value;
4445
}
4546
}
4647

src/PHPCR/Shell/Console/Application/Shell.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class Shell
1818
private $output;
1919
private $hasReadline;
2020
private $prompt;
21-
private $processIsolation;
2221

2322
/**
2423
* Constructor.
@@ -35,7 +34,6 @@ public function __construct(Application $application)
3534
$this->history = getenv('HOME').'/.history_'.$application->getName();
3635
$this->output = new ConsoleOutput();
3736
$this->prompt = $application->getName().' > ';
38-
$this->processIsolation = false;
3937
}
4038

4139
/**
@@ -129,14 +127,4 @@ private function readline()
129127

130128
return $line;
131129
}
132-
133-
public function getProcessIsolation()
134-
{
135-
return $this->processIsolation;
136-
}
137-
138-
public function setProcessIsolation($processIsolation)
139-
{
140-
$this->processIsolation = (Boolean) $processIsolation;
141-
}
142130
}

src/PHPCR/Shell/Test/EmbeddedContext.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,25 @@
44

55
use PHPCR\Shell\Console\Application\EmbeddedApplication;
66
use PHPCR\Shell\Phpcr\PhpcrSession;
7+
use PHPCR\Shell\PhpcrShell;
8+
use PHPCR\Shell\DependencyInjection\Container;
79

810
/**
9-
* Features context.
11+
* Features context
12+
*
13+
* Start the shell in the embedded context
1014
*/
1115
class EmbeddedContext extends ContextBase
1216
{
13-
private $application;
14-
1517
protected function createTester()
1618
{
1719
// embbed a new session
1820
$session = $this->getSession(null, true);
21+
$container = new Container(PhpcrShell::MODE_EMBEDDED_SHELL);
22+
$container->get('phpcr.session_manager')->setSession(new PhpcrSession($session));
23+
$application = $container->get('application');
1924

20-
$this->application = new EmbeddedApplication(EmbeddedApplication::MODE_SHELL);
21-
$this->application->getHelperSet()->get('phpcr')->setSession(new PhpcrSession($session));
22-
23-
$tester = new ApplicationTester($this->application);
25+
$tester = new ApplicationTester($application);
2426

2527
return $tester;
2628
}

0 commit comments

Comments
 (0)