Skip to content

Commit 0ae0b3c

Browse files
committed
Fixed phpspec tests
1 parent 10ea10f commit 0ae0b3c

File tree

12 files changed

+31
-30
lines changed

12 files changed

+31
-30
lines changed

spec/PHPCR/Shell/Console/Helper/ConfigHelperSpec.php renamed to spec/PHPCR/Shell/Config/ConfigManagerSpec.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22

3-
namespace spec\PHPCR\Shell\Console\Helper;
3+
namespace spec\PHPCR\Shell\Config;
44

55
use PhpSpec\ObjectBehavior;
66
use Prophecy\Argument;
77
use Symfony\Component\Filesystem\Filesystem;
88

9-
class ConfigHelperSpec extends ObjectBehavior
9+
class ConfigManagerSpec extends ObjectBehavior
1010
{
1111
function let(
1212
Filesystem $filesystem
@@ -17,7 +17,7 @@ function let(
1717

1818
function it_is_initializable()
1919
{
20-
$this->shouldHaveType('PHPCR\Shell\Console\Helper\ConfigHelper');
20+
$this->shouldHaveType('PHPCR\Shell\Config\ConfigManager');
2121
}
2222

2323
function it_should_have_a_method_to_get_the_users_config_directory()
@@ -34,7 +34,7 @@ function it_should_be_able_to_parse_a_config_file_and_return_the_config_as_an_ar
3434
putenv('PHPCRSH_HOME=' . $dir);
3535
$filesystem->exists(Argument::any())->willReturn(true);
3636

37-
$config = $this->getConfig('alias')->shouldReturn(array(
37+
$this->getConfig('alias')->shouldReturn(array(
3838
'foobar' => 'barfoo',
3939
'barfoo' => 'foobar',
4040
));

spec/PHPCR/Shell/Config/ProfileLoaderSpec.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44

55
use PhpSpec\ObjectBehavior;
66
use Prophecy\Argument;
7-
use PHPCR\Shell\Console\Helper\ConfigHelper;
7+
use PHPCR\Shell\Config\ConfigManager;
88
use PHPCR\Shell\Config\Profile;
99
use Symfony\Component\Filesystem\Filesystem;
1010

1111
class ProfileLoaderSpec extends ObjectBehavior
1212
{
1313
function let(
14-
ConfigHelper $configHelper,
14+
ConfigManager $configManager,
1515
Filesystem $filesystem
1616
)
1717
{
18-
$configHelper->getConfigDir()->willReturn(__DIR__);
19-
$this->beConstructedWith($configHelper, $filesystem);
18+
$configManager->getConfigDir()->willReturn(__DIR__);
19+
$this->beConstructedWith($configManager, $filesystem);
2020
}
2121

2222
function it_is_initializable()

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use PhpSpec\ObjectBehavior;
66
use Prophecy\Argument;
77
use PHPCR\Shell\Console\Application\EmbeddedApplication;
8+
use Symfony\Component\DependencyInjection\ContainerInterface;
89

910
class EmbeddedApplicationSpec extends ObjectBehavior
1011
{

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
use PhpSpec\ObjectBehavior;
66
use Prophecy\Argument;
7+
use Symfony\Component\DependencyInjection\ContainerInterface;
8+
use PHPCR\Shell\Console\Application\EmbeddedApplication;
79

810
class ShellApplicationSpec extends ObjectBehavior
911
{

spec/PHPCR/Shell/Console/Helper/RepositoryHelperSpec.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
use PhpSpec\ObjectBehavior;
66
use Prophecy\Argument;
77
use PHPCR\RepositoryInterface;
8-
use PHPCR\Shell\Console\Helper\PhpcrHelper;
8+
use PHPCR\Shell\Phpcr\SessionManager;
99

1010
class RepositoryHelperSpec extends ObjectBehavior
1111
{
1212
function let(
13-
PhpcrHelper $phpcrHelper
13+
SessionManager $sessionManager
1414
) {
15-
$this->beConstructedWith($phpcrHelper);
15+
$this->beConstructedWith($sessionManager);
1616
}
1717

1818
function it_is_initializable()
@@ -21,10 +21,10 @@ function it_is_initializable()
2121
}
2222

2323
function it_provides_a_method_to_say_if_a_descriptor_exists_or_not(
24-
PhpcrHelper $phpcrHelper,
24+
SessionManager $sessionManager,
2525
RepositoryInterface $repository
2626
) {
27-
$phpcrHelper->getRepository()->willReturn($repository);
27+
$sessionManager->getRepository()->willReturn($repository);
2828
$repository->getDescriptorKeys()->willReturn(array(
2929
'foo', 'bar'
3030
));

spec/PHPCR/Shell/Console/Helper/ResultFormatterHelperSpec.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 Prophecy\Argument;
77
use PHPCR\Shell\Console\Helper\TextHelper;
8+
use PHPCR\Shell\Console\Helper\TableHelper;
89

910
class ResultFormatterHelperSpec extends ObjectBehavior
1011
{
1112
function let(
12-
TextHelper $textHelper
13+
TextHelper $textHelper,
14+
TableHelper $tableHelper
1315
)
1416
{
15-
$this->beConstructedWith($textHelper);
17+
$this->beConstructedWith($textHelper, $tableHelper);
1618
}
1719

1820
function it_is_initializable()
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
namespace spec\PHPCR\Shell\Console\Helper;
3+
namespace spec\PHPCR\Shell\Phpcr;
44

55
use PhpSpec\ObjectBehavior;
66
use Prophecy\Argument;
77
use PHPCR\Shell\Config\Profile;
88
use PHPCR\Shell\Transport\TransportRegistryInterface;
99

10-
class PhpcrHelperSpec extends ObjectBehavior
10+
class SessionManagerSpec extends ObjectBehavior
1111
{
1212
function let(
1313
Profile $profile,
@@ -18,6 +18,6 @@ function let(
1818

1919
function it_is_initializable()
2020
{
21-
$this->shouldHaveType('PHPCR\Shell\Console\Helper\PhpcrHelper');
21+
$this->shouldHaveType('PHPCR\Shell\Phpcr\SessionManager');
2222
}
2323
}

spec/PHPCR/Shell/Subscriber/AliasSubscriberSpec.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use PhpSpec\ObjectBehavior;
66
use Prophecy\Argument;
7-
use PHPCR\Shell\Console\Helper\ConfigHelper;
7+
use PHPCR\Shell\Config\ConfigManager;
88
use PHPCR\Shell\Console\Input\StringInput;
99
use PHPCR\Shell\Event\CommandPreRunEvent;
1010
use Symfony\Component\Console\Helper\HelperSet;
@@ -17,13 +17,10 @@ function it_is_initializable()
1717
}
1818

1919
function let(
20-
HelperSet $helperSet,
21-
ConfigHelper $config
20+
ConfigManager $config
2221
) {
23-
$helperSet->get('config')->willReturn($config);
24-
2522
$this->beConstructedWith(
26-
$helperSet
23+
$config
2724
);
2825

2926
$config->getConfig('alias')->willReturn(array(
@@ -34,7 +31,6 @@ function let(
3431

3532
function it_should_convert_an_aliased_input_into_a_real_command_input(
3633
CommandPreRunEvent $event,
37-
ConfigHelper $config,
3834
StringInput $input
3935
) {
4036
$event->getInput()->willReturn($input);
@@ -49,7 +45,6 @@ function it_should_convert_an_aliased_input_into_a_real_command_input(
4945

5046
function it_should_ommit_missing_arguments(
5147
CommandPreRunEvent $event,
52-
ConfigHelper $config,
5348
StringInput $input
5449
) {
5550
$event->getInput()->willReturn($input);

src/PHPCR/Shell/Config/ConfigManager.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public function getConfigDir()
7272
if ($home) {
7373
return $home;
7474
}
75-
7675
// handle windows ..
7776
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
7877
if (!getenv('APPDATA')) {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace PHPCR\Shell\Console\Application;
44

55
use PHPCR\Shell\Subscriber;
6+
use Symfony\Component\DependencyInjection\ContainerInterface;
67

78
/**
89
* Subclass of the full ShellApplication for running as an EmbeddedApplication
@@ -25,9 +26,9 @@ class EmbeddedApplication extends ShellApplication
2526
*
2627
* @param string $mode
2728
*/
28-
public function __construct($mode)
29+
public function __construct(ContainerInterface $container, $mode)
2930
{
30-
parent::__construct(SessionApplication::APP_NAME, SessionApplication::APP_VERSION);
31+
parent::__construct($container, SessionApplication::APP_NAME, SessionApplication::APP_VERSION);
3132
$this->mode = $mode;
3233
$this->setAutoExit(false);
3334
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use PHPCR\Shell\Transport\TransportRegistry;
3131
use PHPCR\Shell\Config\ProfileLoader;
3232
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
33+
use Symfony\Component\EventDispatcher\EventDispatcher;
3334

3435
/**
3536
* Main application for PHPCRSH
@@ -63,7 +64,7 @@ class ShellApplication extends Application
6364
public function __construct($container)
6465
{
6566
parent::__construct(SessionApplication::APP_NAME, SessionApplication::APP_VERSION);
66-
$this->dispatcher = $container->get('event.dispatcher');
67+
$this->dispatcher = $container->get('event.dispatcher') ? : new EventDispatcher();
6768
$this->setDispatcher($this->dispatcher);
6869
$this->container = $container;
6970
}

0 commit comments

Comments
 (0)