Skip to content

[WIP] Refactoring to use container #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
language: php

env:
- BEHAT_SUITE=standalone
- BEHAT_SUITE=embedded
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now testing with both modes of operation



php:
- 5.4

before_script:
- composer install
- composer install --dev
- bash tests/bin/travis_jackrabbit.sh

script:
- phpunit
- php vendor/behat/behat/bin/behat
- php vendor/bin/phpspec run
- php vendor/behat/behat/bin/behat --suite=$BEHAT_SUITE
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
dev-master
----------

- [global] Refactored to use DI container and various general improvements
- [node:references] Shows the referencing node paths instead of the referrered-to node path(s)

alpha-6
Expand Down
16 changes: 16 additions & 0 deletions behat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
default:
suites:
standalone:
contexts:
- PHPCR\Shell\Test\StandaloneContext
paths:
- features/all
- features/standalone
- features/shell
embedded:
filter:
tag: "~@standalone"
contexts:
- PHPCR\Shell\Test\EmbeddedContext
paths:
- features/all
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
"phpcr/phpcr-utils": "~1.2",
"symfony/finder": "~2.3",
"symfony/serializer": "~2.3",
"symfony/yaml": "~2.3"
"symfony/yaml": "~2.3",
"symfony/dependency-injection": "~2.3"
},
"minimum-stability": "dev",
"require-dev": {
"symfony/symfony": "2.6",
"symfony/process": "~2.3",
"symfony/filesystem": "~2.3",
"phpunit/phpunit": "~3.7.28",
"behat/behat": "~2.5",
"behat/behat": "~3.0.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/ upgraded to Behat 3.0

"phpspec/phpspec": "2.0",
"jackalope/jackalope-doctrine-dbal": "~1.1",
"jackalope/jackalope-jackrabbit": "~1.1"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ Feature: Move a node in the current session

Background:
Given that I am logged in as "testuser"
And the "session_data.xml" fixtures are loaded
And the "cms.xml" fixtures are loaded

Scenario: Move node
Given I execute the "node:move /tests_general_base/index.txt /foobar" command
Given I execute the "node:move /cms/test /foobar" command
Then the command should not fail
And I execute the "session:save" command
And there should exist a node at "/foobar"
And there should not exist a node at "/tests_general_base/index.txt"

Scenario: Move node relative paths
Given the current node is "/tests_general_base/index.txt"
Given the current node is "/cms/test"
And I execute the "node:move . /barfoo" command
Then the command should not fail
And I execute the "session:save" command
And there should exist a node at "/barfoo"
And there should not exist a node at "/tests_general_base/index.txt"

Scenario: Move onto existing target
Given the current node is "/tests_general_base/index.txt"
And I execute the "node:move . /tests_general_base/daniel" command
Given the current node is "/cms/test"
And I execute the "node:move . /cms/products" command
Then the command should not fail
And I execute the "session:save" command
And there should exist a node at "/tests_general_base/daniel/index.txt"
And there should exist a node at "/cms/products/test"
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Feature: Remove a single property at a specified path
And there should not exist a property at "/cms/articles/article1/title"

Scenario: Try and remove a node
And I execute the "node:property:remove /tests_general_base" command
Given I execute the "node:property:remove /tests_general_base" command
Then the command should fail
And I should see the following:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ Feature: Unregister a node type
As a user that is logged into the shell
I need to be able to do that

# This is not currently implemented by Jackrabbit

Background:
Given that I am logged in as "testuser"

Scenario: Unregister a node type
Given the "example.cnd" node type is loaded
And I execute the "node-type:unregister ns:NodeType" command
Then the command should fail
And I should see the following:
"""
NodeType not found
"""

Scenario: Attempt to unregister a non-registered node type
Given the "example.cnd" node type is loaded
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Feature: Command aliases

Examples:
| command |
| use default |
| select * from [nt:unstructured] |
| cd cms |
| rm cms |
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@standlone
Feature: Login to the session
In order to reconnect as a different user from a session
As a user logged into the shell
Expand Down
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
<?php

namespace spec\PHPCR\Shell\Console\Helper;
namespace spec\PHPCR\Shell\Config;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Filesystem\Filesystem;

class ConfigHelperSpec extends ObjectBehavior
class ConfigManagerSpec extends ObjectBehavior
{
function let(
public function let(
Filesystem $filesystem
)
{
$this->beConstructedWith($filesystem);
}

function it_is_initializable()
public function it_is_initializable()
{
$this->shouldHaveType('PHPCR\Shell\Console\Helper\ConfigHelper');
$this->shouldHaveType('PHPCR\Shell\Config\ConfigManager');
}

function it_should_have_a_method_to_get_the_users_config_directory()
public function it_should_have_a_method_to_get_the_users_config_directory()
{
putenv('PHPCRSH_HOME=/home/foobar');
$this->getConfigDir()->shouldReturn('/home/foobar');
}

function it_should_be_able_to_parse_a_config_file_and_return_the_config_as_an_array(
public function it_should_be_able_to_parse_a_config_file_and_return_the_config_as_an_array(
Filesystem $filesystem
)
{
$dir = __DIR__ . '/fixtures/config';
putenv('PHPCRSH_HOME=' . $dir);
$filesystem->exists(Argument::any())->willReturn(true);

$config = $this->getConfig('alias')->shouldReturn(array(
$this->getConfig('alias')->shouldReturn(array(
'foobar' => 'barfoo',
'barfoo' => 'foobar',
));
Expand Down
18 changes: 9 additions & 9 deletions spec/PHPCR/Shell/Config/ProfileLoaderSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use PHPCR\Shell\Console\Helper\ConfigHelper;
use PHPCR\Shell\Config\ConfigManager;
use PHPCR\Shell\Config\Profile;
use Symfony\Component\Filesystem\Filesystem;

class ProfileLoaderSpec extends ObjectBehavior
{
function let(
ConfigHelper $configHelper,
public function let(
ConfigManager $configManager,
Filesystem $filesystem
)
{
$configHelper->getConfigDir()->willReturn(__DIR__);
$this->beConstructedWith($configHelper, $filesystem);
$configManager->getConfigDir()->willReturn(__DIR__);
$this->beConstructedWith($configManager, $filesystem);
}

function it_is_initializable()
public function it_is_initializable()
{
$this->shouldHaveType('PHPCR\Shell\Config\ProfileLoader');
}

function it_should_list_profile_names()
public function it_should_list_profile_names()
{
$this->getProfileNames()->shouldReturn(array(
'one', 'two'
));
}

function it_should_load_data_into_a_given_profile(
public function it_should_load_data_into_a_given_profile(
Profile $profile,
Filesystem $filesystem
)
Expand All @@ -51,7 +51,7 @@ function it_should_load_data_into_a_given_profile(
$this->loadProfile($profile);
}

function it_should_save_a_given_profile(
public function it_should_save_a_given_profile(
Profile $profile,
Filesystem $filesystem
)
Expand Down
10 changes: 4 additions & 6 deletions spec/PHPCR/Shell/Config/ProfileSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,28 @@
namespace spec\PHPCR\Shell\Config;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use PHPCR\Shell\Transport\TransportConfig;

class ProfileSpec extends ObjectBehavior
{
function let()
public function let()
{
$this->beConstructedWith(
'foobar'
);
}

function it_is_initializable()
public function it_is_initializable()
{
$this->shouldHaveType('PHPCR\Shell\Config\Profile');
}

function it_has_a_method_to_set_config(
public function it_has_a_method_to_set_config(
)
{
$this->set('transport', array());
}

function it_has_a_method_to_get_config()
public function it_has_a_method_to_get_config()
{
$this->set('transport', array(
'foo' => 'bar'
Expand Down
2 changes: 1 addition & 1 deletion spec/PHPCR/Shell/Config/profiles/one.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
transport:
transport:
name: foobar
bar_foo: barfoo
foo_bar: foobar
Expand Down
10 changes: 6 additions & 4 deletions spec/PHPCR/Shell/Console/Application/EmbeddedApplicationSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
namespace spec\PHPCR\Shell\Console\Application;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use PHPCR\Shell\Console\Application\EmbeddedApplication;
use Symfony\Component\DependencyInjection\ContainerInterface;

class EmbeddedApplicationSpec extends ObjectBehavior
{
function let()
public function let(
ContainerInterface $container
)
{
$this->beConstructedWith(EmbeddedApplication::MODE_COMMAND);
$this->beConstructedWith($container, EmbeddedApplication::MODE_COMMAND);
}

function it_is_initializable()
public function it_is_initializable()
{
$this->shouldHaveType('PHPCR\Shell\Console\Application\EmbeddedApplication');
}
Expand Down
12 changes: 10 additions & 2 deletions spec/PHPCR/Shell/Console/Application/ShellApplicationSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
namespace spec\PHPCR\Shell\Console\Application;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\DependencyInjection\ContainerInterface;
use PHPCR\Shell\Console\Application\EmbeddedApplication;

class ShellApplicationSpec extends ObjectBehavior
{
function it_is_initializable()
public function let(
ContainerInterface $container
)
{
$this->beConstructedWith($container, EmbeddedApplication::MODE_COMMAND);
}

public function it_is_initializable()
{
$this->shouldHaveType('PHPCR\Shell\Console\Application\ShellApplication');
}
Expand Down
3 changes: 1 addition & 2 deletions spec/PHPCR/Shell/Console/Helper/EditorHelperSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
namespace spec\PHPCR\Shell\Console\Helper;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class EditorHelperSpec extends ObjectBehavior
{
function it_is_initializable()
public function it_is_initializable()
{
$this->shouldHaveType('PHPCR\Shell\Console\Helper\EditorHelper');
}
Expand Down
7 changes: 3 additions & 4 deletions spec/PHPCR/Shell/Console/Helper/NodeHelperSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
namespace spec\PHPCR\Shell\Console\Helper;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use PHPCR\NodeInterface;
use PHPCR\NodeType\NodeTypeInterface;

class NodeHelperSpec extends ObjectBehavior
{
function it_is_initializable()
public function it_is_initializable()
{
$this->shouldHaveType('PHPCR\Shell\Console\Helper\NodeHelper');
}

function it_should_provide_a_method_to_determine_if_a_node_has_a_given_mixin(
public function it_should_provide_a_method_to_determine_if_a_node_has_a_given_mixin(
NodeInterface $node,
NodeTypeInterface $mixin1,
NodeTypeInterface $mixin2,
Expand All @@ -33,7 +32,7 @@ function it_should_provide_a_method_to_determine_if_a_node_has_a_given_mixin(
$this->nodeHasMixinType($node, 'mixin5')->shouldReturn(false);
}

function it_should_provide_a_method_to_determine_if_a_node_is_versionable(
public function it_should_provide_a_method_to_determine_if_a_node_is_versionable(
NodeInterface $nodeVersionable,
NodeInterface $nodeNotVersionable,
NodeTypeInterface $mixin1,
Expand Down
7 changes: 3 additions & 4 deletions spec/PHPCR/Shell/Console/Helper/PathHelperSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@
namespace spec\PHPCR\Shell\Console\Helper;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class PathHelperSpec extends ObjectBehavior
{
function it_is_initializable()
public function it_is_initializable()
{
$this->shouldHaveType('PHPCR\Shell\Console\Helper\PathHelper');
}

function it_has_a_method_to_provide_the_parent_path_for_a_given_path()
public function it_has_a_method_to_provide_the_parent_path_for_a_given_path()
{
$this->getParentPath('/foo/bar')->shouldReturn('/foo');
}

function it_has_a_method_to_get_the_node_name_of_a_given_path()
public function it_has_a_method_to_get_the_node_name_of_a_given_path()
{
$this->getNodeName('/foo/bar')->shouldReturn('bar');
}
Expand Down
Loading