Issue/327 versioning (#345)

* Switch to semver format

* Rewrite new version check to use Github Releases and cron

* Styling

* Remove v from in front of version

* New version check test fix

* Uncomment test case
This commit is contained in:
Nabeel S
2019-08-06 17:48:00 -04:00
committed by GitHub
parent 092b9fc9dc
commit e12188b7d3
16 changed files with 1195 additions and 298 deletions

View File

@@ -1,6 +1,11 @@
<?php
use App\Repositories\SettingRepository;
use App\Services\DatabaseService;
use GuzzleHttp\Client;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;
use Tests\TestData;
/**
@@ -103,6 +108,60 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
}
}
/**
* Read a file from the data directory
*
* @param $filename
*
* @return false|string
*/
public function readDataFile($filename)
{
$paths = [
'data/'.$filename,
'tests/data/'.$filename,
];
foreach ($paths as $p) {
if (file_exists($p)) {
return file_get_contents($p);
}
}
}
/**
* Return a mock Guzzle Client with a response loaded from $mockFile
*
* @param $mockFile
*/
public function mockGuzzleClient($mockFile): void
{
$mock = new MockHandler([
new Response(200,
[
'Content-Type' => 'application/json; charset=utf-8',
],
$this->readDataFile($mockFile)
),
]);
$handler = HandlerStack::create($mock);
$guzzleClient = new Client(['handler' => $handler]);
app()->instance(Client::class, $guzzleClient);
}
/**
* Update a setting
*
* @param $key
* @param $value
*/
public function updateSetting($key, $value)
{
$settingsRepo = app(SettingRepository::class);
$settingsRepo->store($key, $value);
}
/**
* So we can test private/protected methods
* http://bit.ly/1mr5hMq