Skip to content

Commit

Permalink
Merge branch '3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
crynobone committed Mar 10, 2015
2 parents 1320d24 + fcf16f9 commit 25be00a
Show file tree
Hide file tree
Showing 14 changed files with 146 additions and 150 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Composer
composer.lock
vendor/*

# Build
.subsplit/
1 change: 1 addition & 0 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ $finder = Symfony\Component\Finder\Finder::create()
->ignoreVCS(true);

return Symfony\CS\Config\Config::create()
->setUsingCache(true)
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
->fixers([
'-psr0',
Expand Down
8 changes: 4 additions & 4 deletions tests/CollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
*/
public function testToCsvMethod()
{
$stub = new Collection(array(
array('id' => 1, 'name' => 'Mior Muhammad Zaki'),
array('id' => 2, 'name' => 'Taylor Otwell'),
));
$stub = new Collection([
['id' => 1, 'name' => 'Mior Muhammad Zaki'],
['id' => 2, 'name' => 'Taylor Otwell'],
]);

$expected = <<<EXPECTED
id,name
Expand Down
2 changes: 1 addition & 1 deletion tests/ExpressionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class ExpressionTest extends \PHPUnit_Framework_TestCase
{
/**
* Test constructing Orchestra\Support\Expression
* Test constructing Orchestra\Support\Expression.
*
* @test
*/
Expand Down
43 changes: 21 additions & 22 deletions tests/Ftp/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ public function setUp()
{
Morph::$prefix = '\Orchestra\Support\Ftp\TestCase\mock1_ftp_';

$this->stub = new Client(array(
$this->stub = new Client([
'host' => 'sftp://localhost:22',
'user' => 'foo',
'password' => 'foobar',
));
]);
}

/**
Expand All @@ -43,7 +43,7 @@ public function testInstanceOfFTP()
{
Morph::$prefix = '\Orchestra\Support\Ftp\TestCase\mock1_ftp_';

$stub = Client::make(array('connection' => new StreamStub));
$stub = Client::make(['connection' => new StreamStub()]);

$this->assertInstanceOf('\Orchestra\Support\Ftp\Client', $stub);

Expand Down Expand Up @@ -78,11 +78,11 @@ public function testConnectMethodSuccessful()
$this->assertTrue($this->stub->connect());
$this->assertTrue($this->stub->connected());

$stub = new Client(array(
$stub = new Client([
'host' => 'ftp://localhost:21',
'user' => 'foo',
'password' => 'foobar',
));
]);

$this->assertFalse($stub->connected());
$this->assertTrue($stub->connect());
Expand All @@ -98,10 +98,10 @@ public function testConnectMethodWhenHostIsNotDefined()
{
Morph::$prefix = '\Orchestra\Support\Ftp\TestCase\mock1_ftp_';

$stub = new Client(array(
$stub = new Client([
'user' => 'foo',
'password' => 'foobar',
));
]);

$this->assertNull($stub->connect());
}
Expand All @@ -115,11 +115,11 @@ public function testConnectMethodSFTPConnectThrowsException()
{
Morph::$prefix = '\Orchestra\Support\Ftp\TestCase\mock2_ftp_';

$stub = new Client(array(
$stub = new Client([
'host' => 'sftp://localhost:22',
'user' => 'foo',
'password' => 'foobar',
));
]);

$stub->connect();
}
Expand All @@ -133,11 +133,11 @@ public function testConnectMethodFTPConnectThrowsException()
{
Morph::$prefix = '\Orchestra\Support\Ftp\TestCase\mock2_ftp_';

$stub = new Client(array(
$stub = new Client([
'host' => 'ftp://localhost:21',
'user' => 'foo',
'password' => 'foobar',
));
]);

$stub->connect();
}
Expand All @@ -151,11 +151,11 @@ public function testConnectMethodFTPLoginThrowsException()
{
Morph::$prefix = '\Orchestra\Support\Ftp\TestCase\mock3_ftp_';

$stub = new Client(array(
$stub = new Client([
'host' => 'ftp://localhost:21',
'user' => 'foo',
'password' => 'foobar',
));
]);

$stub->connect();
}
Expand All @@ -178,7 +178,7 @@ public function testFTPFacadeMethodsSuccessful()
$this->assertTrue($this->stub->rename('/var/www/home.php', '/var/www/dashboard.php'));
$this->assertTrue($this->stub->delete('/var/www/home.php'));
$this->assertTrue($this->stub->permission('/var/www/index.php', 755));
$this->assertEquals(array('foo.php', 'foobar.php'), $this->stub->allFiles('/var/www/foo/'));
$this->assertEquals(['foo.php', 'foobar.php'], $this->stub->allFiles('/var/www/foo/'));
$this->assertTrue($this->stub->makeDirectory('/var/www/orchestra'));
$this->assertTrue($this->stub->removeDirectory('/var/www/orchestra'));
}
Expand All @@ -193,27 +193,26 @@ public function testFTPFacadeThrowsException()
Morph::$prefix = '\Orchestra\Support\Ftp\TestCase\mock1_ftp_';

try {
Morph::fire('invalid_method', array('foo'));
Morph::fire('invalid_method', ['foo']);
} catch (\Orchestra\Support\Ftp\RuntimeException $e) {
$this->assertTrue(true, 'Excepted Exception');
$this->assertEquals(array('foo'), $e->getParameters());
$this->assertEquals(['foo'], $e->getParameters());
}
}
}

class StreamStub
{

}

function mock1_ftp_ssl_connect()
{
return new StreamStub;
return new StreamStub();
}

function mock1_ftp_connect()
{
return new StreamStub;
return new StreamStub();
}

function mock1_ftp_login()
Expand Down Expand Up @@ -273,7 +272,7 @@ function mock1_ftp_chmod()

function mock1_ftp_nlist()
{
return array('foo.php', 'foobar.php');
return ['foo.php', 'foobar.php'];
}

function mock1_ftp_mkdir()
Expand All @@ -298,12 +297,12 @@ function mock2_ftp_connect()

function mock3_ftp_ssl_connect()
{
return new StreamStub;
return new StreamStub();
}

function mock3_ftp_connect()
{
return new StreamStub;
return new StreamStub();
}

function mock3_ftp_login()
Expand Down
118 changes: 59 additions & 59 deletions tests/NestyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class NestyTest extends \PHPUnit_Framework_TestCase
*/
public function setUp()
{
$this->stub = new Nesty(array());
$this->stub = new Nesty([]);
}

/**
Expand All @@ -42,7 +42,7 @@ public function testInstanceOfNesty()
$config = $refl->getProperty('config');
$config->setAccessible(true);

$this->assertEquals(array(), $config->getValue($this->stub));
$this->assertEquals([], $config->getValue($this->stub));
}

/**
Expand All @@ -53,7 +53,7 @@ public function testInstanceOfNesty()
*/
public function testNewInstanceReturnEmptyArray()
{
$this->assertEquals(new Collection(array()), with(new Nesty(array()))->items());
$this->assertEquals(new Collection([]), with(new Nesty([]))->items());
}

/**
Expand All @@ -63,53 +63,53 @@ public function testNewInstanceReturnEmptyArray()
*/
public function testAddMethod()
{
$foobar = new Fluent(array(
$foobar = new Fluent([
'id' => 'foobar',
'childs' => array(
'hello-foobar' => new Fluent(array(
'childs' => [
'hello-foobar' => new Fluent([
'id' => 'hello-foobar',
'childs' => array(),
)),
),
));
$foo = new Fluent(array(
'childs' => [],
]),
],
]);
$foo = new Fluent([
'id' => 'foo',
'childs' => array(
'bar' => new Fluent(array(
'childs' => [
'bar' => new Fluent([
'id' => 'bar',
'childs' => array(),
)),
'foobar' => $foobar,
'foo-bar' => new Fluent(array(
'childs' => [],
]),
'foobar' => $foobar,
'foo-bar' => new Fluent([
'id' => 'foo-bar',
'childs' => array(),
)),
'hello-world-foobar' => new Fluent(array(
'childs' => [],
]),
'hello-world-foobar' => new Fluent([
'id' => 'hello-world-foobar',
'childs' => array(),
)),
)
));
'childs' => [],
]),
],
]);

$expected = array(
'crynobone' => new Fluent(array(
$expected = [
'crynobone' => new Fluent([
'id' => 'crynobone',
'childs' => array(),
)),
'hello' => new Fluent(array(
'childs' => [],
]),
'hello' => new Fluent([
'id' => 'hello',
'childs' => array(),
)),
'world' => new Fluent(array(
'childs' => [],
]),
'world' => new Fluent([
'id' => 'world',
'childs' => array(),
)),
'foo' => $foo,
'orchestra' => new Fluent(array(
'childs' => [],
]),
'foo' => $foo,
'orchestra' => new Fluent([
'id' => 'orchestra',
'childs' => array(),
)),
);
'childs' => [],
]),
];

$this->stub->add('foo');
$this->stub->add('hello', '<:foo');
Expand All @@ -134,18 +134,18 @@ public function testAddMethod()
*/
public function testAddBeforeMethod()
{
$stub = new Nesty(array());
$stub = new Nesty([]);

$expected = array(
'foobar' => new Fluent(array(
$expected = [
'foobar' => new Fluent([
'id' => 'foobar',
'childs' => array(),
)),
'foo' => new Fluent(array(
'childs' => [],
]),
'foo' => new Fluent([
'id' => 'foo',
'childs' => array(),
)),
);
'childs' => [],
]),
];

$stub->add('foo', '<:home');
$stub->add('foobar', '<:foo');
Expand All @@ -158,18 +158,18 @@ public function testAddBeforeMethod()
*/
public function testAddAfterMethod()
{
$stub = new Nesty(array());
$stub = new Nesty([]);

$expected = array(
'foobar' => new Fluent(array(
$expected = [
'foobar' => new Fluent([
'id' => 'foobar',
'childs' => array(),
)),
'foo' => new Fluent(array(
'childs' => [],
]),
'foo' => new Fluent([
'id' => 'foo',
'childs' => array(),
)),
);
'childs' => [],
]),
];

$stub->add('foobar', '>:home');
$stub->add('foo', '>:foobar');
Expand All @@ -185,9 +185,9 @@ public function testAddAfterMethod()
*/
public function testAddMethodWhenDecendantIsNotPresented()
{
$stub = new Nesty(array());
$stub = new Nesty([]);

$stub->add('foo', '^:home');
$this->assertEquals(new Collection(array()), $stub->items());
$this->assertEquals(new Collection([]), $stub->items());
}
}
4 changes: 2 additions & 2 deletions tests/Providers/FilterServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function tearDown()
*/
public function testBootMethod()
{
$app = new Container;
$app = new Container();

$router = $app['router'] = m::mock('\Illuminate\Routing\Router');

Expand All @@ -38,5 +38,5 @@ public function testBootMethod()
class StubFilterProvider extends FilterServiceProvider
{
protected $before = ['BeforeFilter'];
protected $after = ['AfterFilter'];
protected $after = ['AfterFilter'];
}
Loading

0 comments on commit 25be00a

Please sign in to comment.