From 182027d3290e9a2e1bd9e2d52c125177ef6c6af6 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 16 Mar 2017 14:48:15 -0500 Subject: [PATCH] Proof of concept of integration testing the framework itself. This leverages the test bench package to integration test the framework itself using a dummy application, allowing for richer integration tests. --- composer.json | 2 ++ src/Illuminate/Support/ServiceProvider.php | 4 ++-- tests/Integration/IntegrationTest.php | 20 ++++++++++++++++++++ tests/Queue/QueueListenerTest.php | 2 +- tests/Support/SupportServiceProviderTest.php | 3 +++ 5 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 tests/Integration/IntegrationTest.php diff --git a/composer.json b/composer.json index b5d8ead3359d..f9f4c2c60d64 100644 --- a/composer.json +++ b/composer.json @@ -38,6 +38,7 @@ "vlucas/phpdotenv": "~2.2" }, "replace": { + "laravel/framework": "5.5.*", "illuminate/auth": "self.version", "illuminate/broadcasting": "self.version", "illuminate/bus": "self.version", @@ -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", diff --git a/src/Illuminate/Support/ServiceProvider.php b/src/Illuminate/Support/ServiceProvider.php index dd4cbfb90fc6..c2f66d5140fd 100755 --- a/src/Illuminate/Support/ServiceProvider.php +++ b/src/Illuminate/Support/ServiceProvider.php @@ -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. diff --git a/tests/Integration/IntegrationTest.php b/tests/Integration/IntegrationTest.php new file mode 100644 index 000000000000..e095cd6bed8d --- /dev/null +++ b/tests/Integration/IntegrationTest.php @@ -0,0 +1,20 @@ +get('/'); + + $this->assertEquals('Hello World', $response->content()); + } +} diff --git a/tests/Queue/QueueListenerTest.php b/tests/Queue/QueueListenerTest.php index 76fabbb9b923..22086c26b219 100755 --- a/tests/Queue/QueueListenerTest.php +++ b/tests/Queue/QueueListenerTest.php @@ -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()); } } diff --git a/tests/Support/SupportServiceProviderTest.php b/tests/Support/SupportServiceProviderTest.php index 338ee33be7fb..49ef0bd1124d 100644 --- a/tests/Support/SupportServiceProviderTest.php +++ b/tests/Support/SupportServiceProviderTest.php @@ -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();