Skip to content

Commit

Permalink
Proof of concept of integration testing the framework itself.
Browse files Browse the repository at this point in the history
This leverages the test bench package to integration test the framework
itself using a dummy application, allowing for richer integration tests.
  • Loading branch information
taylorotwell committed Mar 16, 2017
1 parent 3aa2adc commit 182027d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"vlucas/phpdotenv": "~2.2"
},
"replace": {
"laravel/framework": "5.5.*",

This comment has been minimized.

Copy link
@crynobone

crynobone Mar 17, 2017

Member

Wonders what would be the different between "5.5.*" or "self.version".

"illuminate/auth": "self.version",
"illuminate/broadcasting": "self.version",
"illuminate/bus": "self.version",
Expand Down Expand Up @@ -73,6 +74,7 @@
"aws/aws-sdk-php": "~3.0",
"doctrine/dbal": "~2.5",
"mockery/mockery": "~0.9.4",
"orchestra/testbench": "3.5.*",
"pda/pheanstalk": "~3.0",
"phpunit/phpunit": "~6.0",
"predis/predis": "~1.0",
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Support/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ abstract class ServiceProvider
*
* @var array
*/
protected static $publishes = [];
public static $publishes = [];

/**
* The paths that should be published by group.
*
* @var array
*/
protected static $publishGroups = [];
public static $publishGroups = [];

/**
* Create a new service provider instance.
Expand Down
20 changes: 20 additions & 0 deletions tests/Integration/IntegrationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

use Illuminate\Support\Facades\Route;

/**
* @group integration
*/
class IntegrationTest extends Orchestra\Testbench\TestCase
{
public function test_simple_route_through_the_framework()
{
Route::get('/', function () {
return 'Hello World';
});

$response = $this->get('/');

$this->assertEquals('Hello World', $response->content());
}
}
2 changes: 1 addition & 1 deletion tests/Queue/QueueListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ public function testMakeProcessCorrectlyFormatsCommandLine()
$this->assertInstanceOf('Symfony\Component\Process\Process', $process);
$this->assertEquals(__DIR__, $process->getWorkingDirectory());
$this->assertEquals(3, $process->getTimeout());
$this->assertEquals($escape.PHP_BINARY.$escape." artisan queue:work {$escape}connection{$escape} --once --queue={$escape}queue{$escape} --delay=1 --memory=2 --sleep=3 --tries=0", $process->getCommandLine());
$this->assertEquals($escape.PHP_BINARY.$escape." {$escape}artisan{$escape} queue:work {$escape}connection{$escape} --once --queue={$escape}queue{$escape} --delay=1 --memory=2 --sleep=3 --tries=0", $process->getCommandLine());
}
}
3 changes: 3 additions & 0 deletions tests/Support/SupportServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class SupportServiceProviderTest extends TestCase
{
public function setUp()
{
ServiceProvider::$publishes = [];
ServiceProvider::$publishGroups = [];

$app = m::mock('Illuminate\\Foundation\\Application')->makePartial();
$one = new ServiceProviderForTestingOne($app);
$one->boot();
Expand Down

0 comments on commit 182027d

Please sign in to comment.