Skip to content

Commit 1f97510

Browse files
committed
Added license
1 parent c2e02f8 commit 1f97510

File tree

5 files changed

+135
-0
lines changed

5 files changed

+135
-0
lines changed

LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2013 Daniel Leech
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

bin/phpcr renamed to bin/phpcrsh

File renamed without changes.

box.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"alias": "phpcrsh.phar",
3+
"chmod": "0755",
4+
"directories": ["src"],
5+
"files": [
6+
"LICENSE"
7+
],
8+
"finder": [
9+
{
10+
"name": "*.php",
11+
"exclude": ["Tests"],
12+
"in": "vendor"
13+
}
14+
],
15+
"git-version": "package_version",
16+
"main": "bin/phpcrsh",
17+
"output": "phpcrsh.phar",
18+
"stub": true
19+
}

phpunit.xml.dist

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
4+
<phpunit
5+
colors="true"
6+
bootstrap="vendor/autoload.php"
7+
>
8+
9+
<testsuites>
10+
<testsuite name="PHPCR Shell Test Suite">
11+
<directory>./tests</directory>
12+
</testsuite>
13+
</testsuites>
14+
15+
<filter>
16+
<whitelist addUncoveredFilesFromWhitelist="true">
17+
<directory>.</directory>
18+
</whitelist>
19+
</filter>
20+
21+
</phpunit>
+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
3+
namespace PHPCR\Shell;
4+
5+
use PHPCR\SessionInterface;
6+
7+
class PhpcrSessionTest extends \Phpunit_Framework_TestCase
8+
{
9+
public function setUp()
10+
{
11+
$this->phpcr = $this->getMock('PHPCR\SessionInterface');
12+
$this->session = new PhpcrSession($this->phpcr);
13+
}
14+
15+
public function provideChdir()
16+
{
17+
return array(
18+
array('/', '/', '/'),
19+
array('/', 'cms', '/cms'),
20+
array('/', '/cms', '/cms'),
21+
array('/cms', 'foo', '/cms/foo'),
22+
array('/cms', '..', '/'),
23+
array('/', '..', '/'),
24+
array('/cms/foobar/foo', '..', '/cms/foobar'),
25+
);
26+
}
27+
28+
/**
29+
* @dataProvider provideChdir
30+
*/
31+
public function testChdir($cwd, $path, $expected)
32+
{
33+
$this->session->setCwd($cwd);
34+
$this->session->chdir($path);
35+
$this->assertEquals($expected, $this->session->getCwd());
36+
}
37+
38+
public function provideAbsPath()
39+
{
40+
return array(
41+
array('/', '/', '/'),
42+
array('/', 'cms', '/cms'),
43+
array('/', '/cms', '/cms'),
44+
array('/cms', 'foo', '/cms/foo'),
45+
);
46+
}
47+
48+
/**
49+
* @dataProvider provideAbsPath
50+
*/
51+
public function testAbsPath($cwd, $path, $expected)
52+
{
53+
$this->session->setCwd($cwd);
54+
$this->session->chdir($path);
55+
$this->assertEquals($expected, $this->session->getCwd());
56+
}
57+
58+
public function provideMv()
59+
{
60+
return array(
61+
array('/', 'foo', 'bar', '/foo', '/bar')
62+
);
63+
}
64+
65+
/**
66+
* @dataProvider provideMv
67+
*/
68+
public function testMv($cwd, $relSrc, $relTar, $expSrc, $expTar)
69+
{
70+
$this->phpcr->expects($this->once())
71+
->method('move')
72+
->with($expSrc, $expTar);
73+
$this->session->setCwd($cwd);
74+
$this->session->move($relSrc, $relTar);
75+
}
76+
}

0 commit comments

Comments
 (0)