-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1625 from mallardduck/patch-1
Add new methods to satisfy Application contract for Laravel 5.8
- Loading branch information
Showing
4 changed files
with
258 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace Dingo\Api\Tests; | ||
|
||
use Dingo\Api\Tests\Stubs\ApplicationStub; | ||
use Dingo\Api\Tests\Stubs\Application58Stub; | ||
|
||
trait ChecksLaravelVersionTrait | ||
{ | ||
public $installed_file_path = __DIR__.'/../vendor/composer/installed.json'; | ||
public $current_release = '5.8'; | ||
|
||
private function getFrameworkVersion() | ||
{ | ||
$contents = file_get_contents($this->installed_file_path); | ||
$parsed_data = json_decode($contents, true); | ||
$just_laravel = array_filter($parsed_data, function ($val) { | ||
if ('laravel/framework' === $val['name'] || 'laravel/lumen-framework' === $val['name']) { | ||
return true; | ||
} | ||
}); | ||
$laravelVersion = array_map(function ($val) { | ||
return $val['version']; | ||
}, array_values($just_laravel))[0]; | ||
|
||
return $laravelVersion; | ||
} | ||
|
||
private function getApplicationStub() | ||
{ | ||
$version = $this->getFrameworkVersion(); | ||
if ('dev-master' === $version) { | ||
$version = $this->current_release; | ||
} | ||
$compared_versions = version_compare('5.8', $version); | ||
// If comparison is Less Than, or Equal To, provide the 5.8 stub. | ||
if ($compared_versions === -1 || $compared_versions === 0) { | ||
return new Application58Stub; | ||
} | ||
|
||
return new ApplicationStub; | ||
} | ||
} |
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,199 @@ | ||
<?php | ||
|
||
namespace Dingo\Api\Tests\Stubs; | ||
|
||
use Illuminate\Container\Container; | ||
use Illuminate\Contracts\Foundation\Application; | ||
|
||
class Application58Stub extends Container implements Application | ||
{ | ||
public function version() | ||
{ | ||
return 'v1'; | ||
} | ||
|
||
public function basePath() | ||
{ | ||
// | ||
} | ||
|
||
public function bootstrapPath($path = '') | ||
{ | ||
// | ||
} | ||
|
||
public function configPath($path = '') | ||
{ | ||
// | ||
} | ||
|
||
public function databasePath($path = '') | ||
{ | ||
// | ||
} | ||
|
||
public function environmentPath() | ||
{ | ||
// | ||
} | ||
|
||
public function resourcePath($path = '') | ||
{ | ||
// | ||
} | ||
|
||
public function storagePath() | ||
{ | ||
// | ||
} | ||
|
||
public function environment(...$environments) | ||
{ | ||
return 'testing'; | ||
} | ||
|
||
public function runningInConsole() | ||
{ | ||
// | ||
} | ||
|
||
public function runningUnitTests() | ||
{ | ||
// TODO: Implement runningUnitTests() method. | ||
} | ||
|
||
public function isDownForMaintenance() | ||
{ | ||
return false; | ||
} | ||
|
||
public function registerConfiguredProviders() | ||
{ | ||
// | ||
} | ||
|
||
public function register($provider, $options = [], $force = false) | ||
{ | ||
// | ||
} | ||
|
||
public function registerDeferredProvider($provider, $service = null) | ||
{ | ||
// | ||
} | ||
|
||
public function resolveProvider($provider) | ||
{ | ||
// | ||
} | ||
|
||
public function boot() | ||
{ | ||
// | ||
} | ||
|
||
public function booting($callback) | ||
{ | ||
// | ||
} | ||
|
||
public function booted($callback) | ||
{ | ||
// | ||
} | ||
|
||
public function bootstrapWith(array $bootstrappers) | ||
{ | ||
// | ||
} | ||
|
||
public function configurationIsCached() | ||
{ | ||
// | ||
} | ||
|
||
public function detectEnvironment(\Closure $callback) | ||
{ | ||
// | ||
} | ||
|
||
public function environmentFile() | ||
{ | ||
// | ||
} | ||
|
||
public function environmentFilePath() | ||
{ | ||
// | ||
} | ||
|
||
public function getCachedConfigPath() | ||
{ | ||
// | ||
} | ||
|
||
public function getCachedServicesPath() | ||
{ | ||
// | ||
} | ||
|
||
public function getCachedPackagesPath() | ||
{ | ||
// | ||
} | ||
|
||
public function getCachedRoutesPath() | ||
{ | ||
// | ||
} | ||
|
||
public function getLocale() | ||
{ | ||
// | ||
} | ||
|
||
public function getNamespace() | ||
{ | ||
// | ||
} | ||
|
||
public function getProviders($provider) | ||
{ | ||
// | ||
} | ||
|
||
public function hasBeenBootstrapped() | ||
{ | ||
// | ||
} | ||
|
||
public function loadDeferredProviders() | ||
{ | ||
// | ||
} | ||
|
||
public function loadEnvironmentFrom($file) | ||
{ | ||
// | ||
} | ||
|
||
public function routesAreCached() | ||
{ | ||
// | ||
} | ||
|
||
public function setLocale($locale) | ||
{ | ||
// | ||
} | ||
|
||
public function shouldSkipMiddleware() | ||
{ | ||
// | ||
} | ||
|
||
public function terminate() | ||
{ | ||
// | ||
} | ||
} |