Skip to content

Commit

Permalink
Simplify built-in testing in prep for Dusk. (#16667)
Browse files Browse the repository at this point in the history
Simplifies built-in testing and cleans up architecture in prep for Dusk integration.
  • Loading branch information
taylorotwell authored Dec 5, 2016
1 parent 6b988a1 commit 073068c
Show file tree
Hide file tree
Showing 14 changed files with 401 additions and 2,746 deletions.
34 changes: 0 additions & 34 deletions src/Illuminate/Foundation/Testing/Concerns/ImpersonatesUsers.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,38 @@

namespace Illuminate\Foundation\Testing\Concerns;

use Illuminate\Contracts\Auth\Authenticatable as UserContract;

trait InteractsWithAuthentication
{
/**
* Set the currently logged in user for the application.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param string|null $driver
* @return $this
*/
public function actingAs(UserContract $user, $driver = null)
{
$this->be($user, $driver);

return $this;
}

/**
* Set the currently logged in user for the application.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param string|null $driver
* @return void
*/
public function be(UserContract $user, $driver = null)
{
$this->app['auth']->guard($driver)->setUser($user);

$this->app['auth']->shouldUse($driver);
}

/**
* Assert that the user is authenticated.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@

trait InteractsWithConsole
{
/**
* The last code returned by Artisan CLI.
*
* @var int
*/
protected $code;

/**
* Call artisan command and return code.
*
Expand All @@ -22,6 +15,6 @@ trait InteractsWithConsole
*/
public function artisan($command, $parameters = [])
{
return $this->code = $this->app[Kernel::class]->call($command, $parameters);
return $this->app[Kernel::class]->call($command, $parameters);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,6 @@ protected function seeInDatabase($table, array $data, $connection = null)
return $this;
}

/**
* Assert that a given where condition does not exist in the database.
*
* @param string $table
* @param array $data
* @param string $connection
* @return $this
*/
protected function missingFromDatabase($table, array $data, $connection = null)
{
return $this->notSeeInDatabase($table, $data, $connection);
}

/**
* Assert that a given where condition does not exist in the database.
*
Expand All @@ -49,19 +36,6 @@ protected function missingFromDatabase($table, array $data, $connection = null)
* @return $this
*/
protected function dontSeeInDatabase($table, array $data, $connection = null)
{
return $this->notSeeInDatabase($table, $data, $connection);
}

/**
* Assert that a given where condition does not exist in the database.
*
* @param string $table
* @param array $data
* @param string $connection
* @return $this
*/
protected function notSeeInDatabase($table, array $data, $connection = null)
{
$database = $this->app->make('db');

Expand Down
Loading

2 comments on commit 073068c

@hlorofos
Copy link

Choose a reason for hiding this comment

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

@taylorotwell, how we supposed to test json structures now without seeJsonStructure?

@taos-thiagoaos
Copy link

Choose a reason for hiding this comment

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

@taylorotwell i would like to use old seeJsonStructure method in laravel 5.4. How can i use that?

Please sign in to comment.