-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb1e196
commit 2a46789
Showing
10 changed files
with
127 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Tests\Unit; | ||
|
||
use Carbon\Carbon; | ||
use Mockery; | ||
use Onlime\LaravelSqlReporter\Providers\SqlReporterServiceProvider; | ||
use Orchestra\Testbench\TestCase; | ||
|
||
class FeatureTestCase extends TestCase | ||
{ | ||
protected function tearDown(): void | ||
{ | ||
Mockery::close(); | ||
Carbon::setTestNow(); | ||
} | ||
|
||
protected function getPackageProviders($app) | ||
{ | ||
return [SqlReporterServiceProvider::class]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace Tests\Unit; | ||
|
||
use Illuminate\Console\Events\CommandFinished; | ||
use Illuminate\Foundation\Http\Events\RequestHandled; | ||
use Mockery; | ||
use Onlime\LaravelSqlReporter\Listeners\LogSqlQuery; | ||
use Onlime\LaravelSqlReporter\SqlLogger; | ||
|
||
class LogSqlQueryTest extends UnitTestCase | ||
{ | ||
/** | ||
* @var SqlLogger | ||
*/ | ||
private $logger; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->logger = Mockery::spy(SqlLogger::class); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_handle_the_command_finished_event() | ||
{ | ||
$listener = new LogSqlQuery($this->logger); | ||
$listener->handle(Mockery::mock(CommandFinished::class)); | ||
|
||
$this->logger->shouldHaveReceived('log')->once(); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_handle_the_request_handled_event() | ||
{ | ||
$listener = new LogSqlQuery($this->logger); | ||
$listener->handle(Mockery::mock(RequestHandled::class)); | ||
|
||
$this->logger->shouldHaveReceived('log')->once(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.