Skip to content

Commit

Permalink
Fixes code styling.
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed Jun 4, 2014
1 parent f44e91f commit 037b745
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 47 deletions.
3 changes: 1 addition & 2 deletions src/Testbench/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
*/
public function setUp()
{
if ( ! $this->app)
{
if (! $this->app) {
$this->refreshApplication();
}
}
Expand Down
30 changes: 22 additions & 8 deletions src/Testbench/Traits/ApplicationClientTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,16 @@ public function callSecure()
* @param bool $changeHistory
* @return \Illuminate\Http\Response
*/
public function action($method, $action, $wildcards = array(), $parameters = array(), $files = array(), $server = array(), $content = null, $changeHistory = true)
{
public function action(
$method,
$action,
$wildcards = array(),
$parameters = array(),
$files = array(),
$server = array(),
$content = null,
$changeHistory = true
) {
$uri = $this->app['url']->action($action, $wildcards, true);

return $this->call($method, $uri, $parameters, $files, $server, $content, $changeHistory);
Expand All @@ -108,8 +116,16 @@ public function action($method, $action, $wildcards = array(), $parameters = arr
* @param bool $changeHistory
* @return \Illuminate\Http\Response
*/
public function route($method, $name, $routeParameters = array(), $parameters = array(), $files = array(), $server = array(), $content = null, $changeHistory = true)
{
public function route(
$method,
$name,
$routeParameters = array(),
$parameters = array(),
$files = array(),
$server = array(),
$content = null,
$changeHistory = true
) {
$uri = $this->app['url']->route($name, $routeParameters);

return $this->call($method, $uri, $parameters, $files, $server, $content, $changeHistory);
Expand All @@ -125,8 +141,7 @@ public function session(array $data)
{
$this->startSession();

foreach ($data as $key => $value)
{
foreach ($data as $key => $value) {
$this->app['session']->put($key, $value);
}
}
Expand All @@ -150,8 +165,7 @@ public function flushSession()
*/
protected function startSession()
{
if ( ! $this->app['session']->isStarted())
{
if (! $this->app['session']->isStarted()) {
$this->app['session']->start();
}
}
Expand Down
58 changes: 21 additions & 37 deletions src/Testbench/Traits/PHPUnitAssertionsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,19 @@ public function assertResponseStatus($code)
*/
public function assertViewHas($key, $value = null)
{
if (is_array($key)) return $this->assertViewHasAll($key);
if (is_array($key)) {
return $this->assertViewHasAll($key);
}

$response = $this->client->getResponse();

if ( ! isset($response->original) || ! $response->original instanceof View)
{
if (! isset($response->original) || ! $response->original instanceof View) {
return $this->assertTrue(false, 'The response was not a view.');
}

if (is_null($value))
{
if (is_null($value)) {
$this->assertArrayHasKey($key, $response->original->getData());
}
else
{
} else {
$this->assertEquals($value, $response->original->$key);
}
}
Expand All @@ -65,14 +63,10 @@ public function assertViewHas($key, $value = null)
*/
public function assertViewHasAll(array $bindings)
{
foreach ($bindings as $key => $value)
{
if (is_int($key))
{
foreach ($bindings as $key => $value) {
if (is_int($key)) {
$this->assertViewHas($value);
}
else
{
} else {
$this->assertViewHas($key, $value);
}
}
Expand All @@ -88,8 +82,7 @@ public function assertViewMissing($key)
{
$response = $this->client->getResponse();

if ( ! isset($response->original) || ! $response->original instanceof View)
{
if (! isset($response->original) || ! $response->original instanceof View) {
return $this->assertTrue(false, 'The response was not a view.');
}

Expand Down Expand Up @@ -149,14 +142,13 @@ public function assertRedirectedToAction($name, $parameters = array(), $with = a
*/
public function assertSessionHas($key, $value = null)
{
if (is_array($key)) return $this->assertSessionHasAll($key);
if (is_array($key)) {
return $this->assertSessionHasAll($key);
}

if (is_null($value))
{
if (is_null($value)) {
$this->assertTrue($this->app['session.store']->has($key), "Session missing key: $key");
}
else
{
} else {
$this->assertEquals($value, $this->app['session.store']->get($key));
}
}
Expand All @@ -169,14 +161,10 @@ public function assertSessionHas($key, $value = null)
*/
public function assertSessionHasAll(array $bindings)
{
foreach ($bindings as $key => $value)
{
if (is_int($key))
{
foreach ($bindings as $key => $value) {
if (is_int($key)) {
$this->assertSessionHas($value);
}
else
{
} else {
$this->assertSessionHas($key, $value);
}
}
Expand All @@ -197,14 +185,10 @@ public function assertSessionHasErrors($bindings = array(), $format = null)

$errors = $this->app['session.store']->get('errors');

foreach ($bindings as $key => $value)
{
if (is_int($key))
{
foreach ($bindings as $key => $value) {
if (is_int($key)) {
$this->assertTrue($errors->has($value), "Session missing error: $value");
}
else
{
} else {
$this->assertContains($value, $errors->get($key, $format));
}
}
Expand Down

0 comments on commit 037b745

Please sign in to comment.