Skip to content

Commit ff2b15d

Browse files
committed
Merge pull request #114 from phpcr/dicontainer
[WIP] Refactoring to use container
2 parents d273468 + 06cd248 commit ff2b15d

File tree

232 files changed

+1352
-1120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

232 files changed

+1352
-1120
lines changed

.travis.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
language: php
22

3+
env:
4+
- BEHAT_SUITE=standalone
5+
- BEHAT_SUITE=embedded
6+
7+
38
php:
49
- 5.4
510

611
before_script:
7-
- composer install
12+
- composer install --dev
813
- bash tests/bin/travis_jackrabbit.sh
914

1015
script:
1116
- phpunit
12-
- php vendor/behat/behat/bin/behat
1317
- php vendor/bin/phpspec run
18+
- php vendor/behat/behat/bin/behat --suite=$BEHAT_SUITE

CHANGELOG.md

Lines changed: 1 addition & 0 deletions

behat.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
default:
2+
suites:
3+
standalone:
4+
contexts:
5+
- PHPCR\Shell\Test\StandaloneContext
6+
paths:
7+
- features/all
8+
- features/standalone
9+
- features/shell
10+
embedded:
11+
filter:
12+
tag: "~@standalone"
13+
contexts:
14+
- PHPCR\Shell\Test\EmbeddedContext
15+
paths:
16+
- features/all

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@
88
"phpcr/phpcr-utils": "~1.2",
99
"symfony/finder": "~2.3",
1010
"symfony/serializer": "~2.3",
11-
"symfony/yaml": "~2.3"
11+
"symfony/yaml": "~2.3",
12+
"symfony/dependency-injection": "~2.3"
1213
},
1314
"minimum-stability": "dev",
1415
"require-dev": {
16+
"symfony/symfony": "2.6",
1517
"symfony/process": "~2.3",
1618
"symfony/filesystem": "~2.3",
1719
"phpunit/phpunit": "~3.7.28",
18-
"behat/behat": "~2.5",
20+
"behat/behat": "~3.0.0",
1921
"phpspec/phpspec": "2.0",
2022
"jackalope/jackalope-doctrine-dbal": "~1.1",
2123
"jackalope/jackalope-jackrabbit": "~1.1"

features/phpcr_node_move.feature renamed to features/all/phpcr_node_move.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@ Feature: Move a node in the current session
55

66
Background:
77
Given that I am logged in as "testuser"
8-
And the "session_data.xml" fixtures are loaded
8+
And the "cms.xml" fixtures are loaded
99

1010
Scenario: Move node
11-
Given I execute the "node:move /tests_general_base/index.txt /foobar" command
11+
Given I execute the "node:move /cms/test /foobar" command
1212
Then the command should not fail
1313
And I execute the "session:save" command
1414
And there should exist a node at "/foobar"
1515
And there should not exist a node at "/tests_general_base/index.txt"
1616

1717
Scenario: Move node relative paths
18-
Given the current node is "/tests_general_base/index.txt"
18+
Given the current node is "/cms/test"
1919
And I execute the "node:move . /barfoo" command
2020
Then the command should not fail
2121
And I execute the "session:save" command
2222
And there should exist a node at "/barfoo"
2323
And there should not exist a node at "/tests_general_base/index.txt"
2424

2525
Scenario: Move onto existing target
26-
Given the current node is "/tests_general_base/index.txt"
27-
And I execute the "node:move . /tests_general_base/daniel" command
26+
Given the current node is "/cms/test"
27+
And I execute the "node:move . /cms/products" command
2828
Then the command should not fail
2929
And I execute the "session:save" command
30-
And there should exist a node at "/tests_general_base/daniel/index.txt"
30+
And there should exist a node at "/cms/products/test"

features/phpcr_node_property_remove.feature renamed to features/all/phpcr_node_property_remove.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Feature: Remove a single property at a specified path
1414
And there should not exist a property at "/cms/articles/article1/title"
1515

1616
Scenario: Try and remove a node
17-
And I execute the "node:property:remove /tests_general_base" command
17+
Given I execute the "node:property:remove /tests_general_base" command
1818
Then the command should fail
1919
And I should see the following:
2020
"""

features/phpcr_node_type_unregister.feature renamed to features/all/phpcr_node_type_unregister.feature

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@ Feature: Unregister a node type
33
As a user that is logged into the shell
44
I need to be able to do that
55

6+
# This is not currently implemented by Jackrabbit
7+
68
Background:
79
Given that I am logged in as "testuser"
810

911
Scenario: Unregister a node type
1012
Given the "example.cnd" node type is loaded
1113
And I execute the "node-type:unregister ns:NodeType" command
1214
Then the command should fail
13-
And I should see the following:
14-
"""
15-
NodeType not found
16-
"""
1715

1816
Scenario: Attempt to unregister a non-registered node type
1917
Given the "example.cnd" node type is loaded
File renamed without changes.

features/shell_alias.feature renamed to features/shell/shell_alias.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Feature: Command aliases
1818

1919
Examples:
2020
| command |
21-
| use default |
2221
| select * from [nt:unstructured] |
2322
| cd cms |
2423
| rm cms |
File renamed without changes.
File renamed without changes.

features/phpcr_session_login.feature renamed to features/standalone/phpcr_session_login.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@standlone
12
Feature: Login to the session
23
In order to reconnect as a different user from a session
34
As a user logged into the shell

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
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
{
11-
function let(
11+
public function let(
1212
Filesystem $filesystem
1313
)
1414
{
1515
$this->beConstructedWith($filesystem);
1616
}
1717

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

23-
function it_should_have_a_method_to_get_the_users_config_directory()
23+
public function it_should_have_a_method_to_get_the_users_config_directory()
2424
{
2525
putenv('PHPCRSH_HOME=/home/foobar');
2626
$this->getConfigDir()->shouldReturn('/home/foobar');
2727
}
2828

29-
function it_should_be_able_to_parse_a_config_file_and_return_the_config_as_an_array(
29+
public function it_should_be_able_to_parse_a_config_file_and_return_the_config_as_an_array(
3030
Filesystem $filesystem
3131
)
3232
{
3333
$dir = __DIR__ . '/fixtures/config';
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: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,34 @@
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
{
13-
function let(
14-
ConfigHelper $configHelper,
13+
public function let(
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

22-
function it_is_initializable()
22+
public function it_is_initializable()
2323
{
2424
$this->shouldHaveType('PHPCR\Shell\Config\ProfileLoader');
2525
}
2626

27-
function it_should_list_profile_names()
27+
public function it_should_list_profile_names()
2828
{
2929
$this->getProfileNames()->shouldReturn(array(
3030
'one', 'two'
3131
));
3232
}
3333

34-
function it_should_load_data_into_a_given_profile(
34+
public function it_should_load_data_into_a_given_profile(
3535
Profile $profile,
3636
Filesystem $filesystem
3737
)
@@ -51,7 +51,7 @@ function it_should_load_data_into_a_given_profile(
5151
$this->loadProfile($profile);
5252
}
5353

54-
function it_should_save_a_given_profile(
54+
public function it_should_save_a_given_profile(
5555
Profile $profile,
5656
Filesystem $filesystem
5757
)

spec/PHPCR/Shell/Config/ProfileSpec.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,28 @@
33
namespace spec\PHPCR\Shell\Config;
44

55
use PhpSpec\ObjectBehavior;
6-
use Prophecy\Argument;
7-
use PHPCR\Shell\Transport\TransportConfig;
86

97
class ProfileSpec extends ObjectBehavior
108
{
11-
function let()
9+
public function let()
1210
{
1311
$this->beConstructedWith(
1412
'foobar'
1513
);
1614
}
1715

18-
function it_is_initializable()
16+
public function it_is_initializable()
1917
{
2018
$this->shouldHaveType('PHPCR\Shell\Config\Profile');
2119
}
2220

23-
function it_has_a_method_to_set_config(
21+
public function it_has_a_method_to_set_config(
2422
)
2523
{
2624
$this->set('transport', array());
2725
}
2826

29-
function it_has_a_method_to_get_config()
27+
public function it_has_a_method_to_get_config()
3028
{
3129
$this->set('transport', array(
3230
'foo' => 'bar'

spec/PHPCR/Shell/Config/profiles/one.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
transport:
1+
transport:
22
name: foobar
33
bar_foo: barfoo
44
foo_bar: foobar

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

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

55
use PhpSpec\ObjectBehavior;
6-
use Prophecy\Argument;
76
use PHPCR\Shell\Console\Application\EmbeddedApplication;
7+
use Symfony\Component\DependencyInjection\ContainerInterface;
88

99
class EmbeddedApplicationSpec extends ObjectBehavior
1010
{
11-
function let()
11+
public function let(
12+
ContainerInterface $container
13+
)
1214
{
13-
$this->beConstructedWith(EmbeddedApplication::MODE_COMMAND);
15+
$this->beConstructedWith($container, EmbeddedApplication::MODE_COMMAND);
1416
}
1517

16-
function it_is_initializable()
18+
public function it_is_initializable()
1719
{
1820
$this->shouldHaveType('PHPCR\Shell\Console\Application\EmbeddedApplication');
1921
}

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

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

55
use PhpSpec\ObjectBehavior;
6-
use Prophecy\Argument;
6+
use Symfony\Component\DependencyInjection\ContainerInterface;
7+
use PHPCR\Shell\Console\Application\EmbeddedApplication;
78

89
class ShellApplicationSpec extends ObjectBehavior
910
{
10-
function it_is_initializable()
11+
public function let(
12+
ContainerInterface $container
13+
)
14+
{
15+
$this->beConstructedWith($container, EmbeddedApplication::MODE_COMMAND);
16+
}
17+
18+
public function it_is_initializable()
1119
{
1220
$this->shouldHaveType('PHPCR\Shell\Console\Application\ShellApplication');
1321
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
namespace spec\PHPCR\Shell\Console\Helper;
44

55
use PhpSpec\ObjectBehavior;
6-
use Prophecy\Argument;
76

87
class EditorHelperSpec extends ObjectBehavior
98
{
10-
function it_is_initializable()
9+
public function it_is_initializable()
1110
{
1211
$this->shouldHaveType('PHPCR\Shell\Console\Helper\EditorHelper');
1312
}

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@
33
namespace spec\PHPCR\Shell\Console\Helper;
44

55
use PhpSpec\ObjectBehavior;
6-
use Prophecy\Argument;
76
use PHPCR\NodeInterface;
87
use PHPCR\NodeType\NodeTypeInterface;
98

109
class NodeHelperSpec extends ObjectBehavior
1110
{
12-
function it_is_initializable()
11+
public function it_is_initializable()
1312
{
1413
$this->shouldHaveType('PHPCR\Shell\Console\Helper\NodeHelper');
1514
}
1615

17-
function it_should_provide_a_method_to_determine_if_a_node_has_a_given_mixin(
16+
public function it_should_provide_a_method_to_determine_if_a_node_has_a_given_mixin(
1817
NodeInterface $node,
1918
NodeTypeInterface $mixin1,
2019
NodeTypeInterface $mixin2,
@@ -33,7 +32,7 @@ function it_should_provide_a_method_to_determine_if_a_node_has_a_given_mixin(
3332
$this->nodeHasMixinType($node, 'mixin5')->shouldReturn(false);
3433
}
3534

36-
function it_should_provide_a_method_to_determine_if_a_node_is_versionable(
35+
public function it_should_provide_a_method_to_determine_if_a_node_is_versionable(
3736
NodeInterface $nodeVersionable,
3837
NodeInterface $nodeNotVersionable,
3938
NodeTypeInterface $mixin1,

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,20 @@
33
namespace spec\PHPCR\Shell\Console\Helper;
44

55
use PhpSpec\ObjectBehavior;
6-
use Prophecy\Argument;
76

87
class PathHelperSpec extends ObjectBehavior
98
{
10-
function it_is_initializable()
9+
public function it_is_initializable()
1110
{
1211
$this->shouldHaveType('PHPCR\Shell\Console\Helper\PathHelper');
1312
}
1413

15-
function it_has_a_method_to_provide_the_parent_path_for_a_given_path()
14+
public function it_has_a_method_to_provide_the_parent_path_for_a_given_path()
1615
{
1716
$this->getParentPath('/foo/bar')->shouldReturn('/foo');
1817
}
1918

20-
function it_has_a_method_to_get_the_node_name_of_a_given_path()
19+
public function it_has_a_method_to_get_the_node_name_of_a_given_path()
2120
{
2221
$this->getNodeName('/foo/bar')->shouldReturn('bar');
2322
}

0 commit comments

Comments
 (0)