Skip to content

Added style CI #184

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
Aug 23, 2016
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Shell for PHPCR
---------------

[![Build Status](https://travis-ci.org/phpcr/phpcr-shell.png?branch=master)](https://travis-ci.org/phpcr/phpcr-shell)
[![StyleCI](https://styleci.io/repos/14844492/shield)](https://styleci.io/repos/14844492)

Shell for PHPCR

Expand Down
40 changes: 25 additions & 15 deletions features/fixtures/jackalope-doctrine-dbal-cli-config.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
<?php
$dbConn = \Doctrine\DBAL\DriverManager::getConnection(array(

/*
* This file is part of the PHPCR Shell package
*
* (c) Daniel Leech <daniel@dantleech.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

$dbConn = \Doctrine\DBAL\DriverManager::getConnection([
'driver' => 'pdo_sqlite',
'dbname' => 'test',
'path' => __DIR__.'/app.sqlite',
));
]);

/*
* configuration
*/
$workspace = 'default'; // phpcr workspace to use
$user = 'admin';
$pass = 'admin';
$workspace = 'default'; // phpcr workspace to use
$user = 'admin';
$pass = 'admin';

$factory = new \Jackalope\RepositoryFactoryDoctrineDBAL();
$repository = $factory->getRepository(array('jackalope.doctrine_dbal_connection' => $dbConn));
$repository = $factory->getRepository(['jackalope.doctrine_dbal_connection' => $dbConn]);

$credentials = new \PHPCR\SimpleCredentials($user, $pass);

Expand All @@ -25,15 +36,14 @@
) {
$session = $repository->login($credentials, $workspace);

$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
'dialog' => new \Symfony\Component\Console\Helper\DialogHelper(),
'phpcr' => new \PHPCR\Util\Console\Helper\PhpcrHelper($session),
$helperSet = new \Symfony\Component\Console\Helper\HelperSet([
'dialog' => new \Symfony\Component\Console\Helper\DialogHelper(),
'phpcr' => new \PHPCR\Util\Console\Helper\PhpcrHelper($session),
'phpcr_console_dumper' => new \PHPCR\Util\Console\Helper\PhpcrConsoleDumperHelper(),
));
} else if (isset($argv[1]) && $argv[1] == 'jackalope:init:dbal') {
]);
} elseif (isset($argv[1]) && $argv[1] == 'jackalope:init:dbal') {
// special case: the init command needs the db connection, but a session is impossible if the db is not yet initialized
$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
'connection' => new \Jackalope\Tools\Console\Helper\DoctrineDbalHelper($dbConn)
));
$helperSet = new \Symfony\Component\Console\Helper\HelperSet([
'connection' => new \Jackalope\Tools\Console\Helper\DoctrineDbalHelper($dbConn),
]);
}

11 changes: 5 additions & 6 deletions spec/PHPCR/Shell/Config/ConfigManagerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace spec\PHPCR\Shell\Config;
Expand All @@ -19,8 +20,7 @@ class ConfigManagerSpec extends ObjectBehavior
{
public function let(
Filesystem $filesystem
)
{
) {
$this->beConstructedWith($filesystem);
}

Expand All @@ -37,10 +37,9 @@ public function it_should_have_a_method_to_get_the_users_config_directory()

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);
) {
$dir = __DIR__.'/fixtures/config';
putenv('PHPCRSH_HOME='.$dir);
$filesystem->exists(Argument::any())->willReturn(true);

$this->getConfig('alias')->offsetGet('foobar')->shouldReturn('barfoo');
Expand Down
20 changes: 10 additions & 10 deletions spec/PHPCR/Shell/Config/ConfigSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,36 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace spec\PHPCR\Shell\Config;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class ConfigSpec extends ObjectBehavior
{
function it_is_initializable()
public function it_is_initializable()
{
$this->shouldHaveType('PHPCR\Shell\Config\Config');
}

function let()
public function let()
{
$this->beConstructedWith(array(
$this->beConstructedWith([
'foo' => 'bar',
'bar' => array(
'boo' => 'baz'
),
));
'bar' => [
'boo' => 'baz',
],
]);
}

function it_should_be_able_to_access_data_values()
public function it_should_be_able_to_access_data_values()
{
$this['foo']->shouldReturn('bar');
}

function it_should_be_able_to_access_nested_config()
public function it_should_be_able_to_access_nested_config()
{
$this['bar']['boo']->shouldReturn('baz');
}
Expand Down
50 changes: 24 additions & 26 deletions spec/PHPCR/Shell/Config/ProfileLoaderSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace spec\PHPCR\Shell\Config;

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

class ProfileLoaderSpec extends ObjectBehavior
{
public function let(
ConfigManager $configManager,
Filesystem $filesystem
)
{
) {
$configManager->getConfigDir()->willReturn(__DIR__);
$this->beConstructedWith($configManager, $filesystem);
}
Expand All @@ -35,49 +35,47 @@ public function it_is_initializable()

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

public function it_should_load_data_into_a_given_profile(
Profile $profile,
Filesystem $filesystem
)
{
) {
$profile->get('phpcr', 'workspace')->willReturn('default');
$profile->getName()->willReturn('one');
$profile->set('transport', array(
'name' => 'foobar',
$profile->set('transport', [
'name' => 'foobar',
'bar_foo' => 'barfoo',
'foo_bar' => 'foobar',
))->shouldBeCalled();
$profile->set('phpcr', array(
'username' => 'username',
'password' => 'password',
])->shouldBeCalled();
$profile->set('phpcr', [
'username' => 'username',
'password' => 'password',
'workspace' => 'default',
))->shouldBeCalled();
])->shouldBeCalled();

$this->loadProfile($profile);
}

public function it_should_save_a_given_profile(
Profile $profile,
Filesystem $filesystem
)
{
) {
$profile->getName()->willReturn('newprofile');
$profile->toArray()->willReturn(array(
'transport' => array(
'name' => 'test_transport',
$profile->toArray()->willReturn([
'transport' => [
'name' => 'test_transport',
'option1' => 'value1',
),
'phpcr' => array(
],
'phpcr' => [
'username' => 'daniel',
'password' => 'leech',
),
));
$filesystem->dumpFile(Argument::type('string'), <<<EOT
],
]);
$filesystem->dumpFile(Argument::type('string'), <<<'EOT'
transport:
name: test_transport
option1: value1
Expand Down
13 changes: 6 additions & 7 deletions spec/PHPCR/Shell/Config/ProfileSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace spec\PHPCR\Shell\Config;

use PhpSpec\ObjectBehavior;
use PHPCR\Shell\Config\Config;

class ProfileSpec extends ObjectBehavior
{
Expand All @@ -29,16 +29,15 @@ public function it_is_initializable()
}

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

public function it_has_a_method_to_get_config()
{
$this->set('transport', array(
'foo' => 'bar'
));
$this->set('transport', [
'foo' => 'bar',
]);

$this->get('transport')->shouldHaveType('PHPCR\Shell\Config\Config');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,19 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace spec\PHPCR\Shell\Console\Application;

use PhpSpec\ObjectBehavior;
use PHPCR\Shell\Console\Application\EmbeddedApplication;
use Symfony\Component\DependencyInjection\ContainerInterface;
use PHPCR\Shell\PhpcrShell;
use PHPCR\Shell\DependencyInjection\Container;
use PhpSpec\ObjectBehavior;

class EmbeddedApplicationSpec extends ObjectBehavior
{
public function let(
Container $container
)
{
) {
$this->beConstructedWith($container);
}

Expand Down
7 changes: 3 additions & 4 deletions spec/PHPCR/Shell/Console/Application/ShellApplicationSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,20 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace spec\PHPCR\Shell\Console\Application;

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

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

Expand Down
1 change: 1 addition & 0 deletions spec/PHPCR/Shell/Console/Helper/EditorHelperSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace spec\PHPCR\Shell\Console\Helper;
Expand Down
29 changes: 14 additions & 15 deletions spec/PHPCR/Shell/Console/Helper/NodeHelperSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace spec\PHPCR\Shell\Console\Helper;

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

class NodeHelperSpec extends ObjectBehavior
{
Expand All @@ -27,11 +28,10 @@ public function it_should_provide_a_method_to_determine_if_a_node_has_a_given_mi
NodeTypeInterface $mixin1,
NodeTypeInterface $mixin2,
NodeTypeInterface $mixin3
)
{
$node->getMixinNodeTypes()->willReturn(array(
$mixin1, $mixin2, $mixin3
));
) {
$node->getMixinNodeTypes()->willReturn([
$mixin1, $mixin2, $mixin3,
]);

$mixin1->getName()->willReturn('mixin1');
$mixin2->getName()->willReturn('mixin1');
Expand All @@ -46,17 +46,16 @@ public function it_should_provide_a_method_to_determine_if_a_node_is_versionable
NodeInterface $nodeNotVersionable,
NodeTypeInterface $mixin1,
NodeTypeInterface $mixin2
)
{
$nodeVersionable->getMixinNodeTypes()->willReturn(array(
$mixin1, $mixin2
));
$nodeNotVersionable->getMixinNodeTypes()->willReturn(array(
$mixin2
));
) {
$nodeVersionable->getMixinNodeTypes()->willReturn([
$mixin1, $mixin2,
]);
$nodeNotVersionable->getMixinNodeTypes()->willReturn([
$mixin2,
]);
$nodeNotVersionable->getPath()->willReturn('foobar');
$mixin1->getName()->willReturn('mix:versionable');
$this->assertNodeIsVersionable($nodeVersionable)->shouldReturn(null);;
$this->assertNodeIsVersionable($nodeVersionable)->shouldReturn(null);

try {
$this->assertNodeIsVersionable($nodeNotVersionable);
Expand Down
Loading