mirror of
https://github.com/nullthoughts/laravel-data-sync.git
synced 2026-01-27 12:45:14 +00:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
734a6a3cbd | ||
|
|
a241493142 | ||
|
|
9980bc7e9a | ||
|
|
9935cb78cb | ||
|
|
9ade30325c | ||
|
|
effd3be10f | ||
| 412a03516b | |||
|
|
730fe0e2ac | ||
|
|
f830c5b264 | ||
| 95635719d6 | |||
|
|
e57f989c68 | ||
| 3a54f48c65 | |||
| c0f21612fc | |||
|
|
8007b2ae88 | ||
|
|
000f1e3851 | ||
|
|
7bcec7872f | ||
|
|
449dafcb89 | ||
|
|
af513debec | ||
|
|
5759629d34 | ||
|
|
0ab4a4f053 | ||
|
|
163be72b86 | ||
|
|
20b07aeea8 | ||
|
|
168923d3da | ||
|
|
b177e8de2c | ||
|
|
cd3adf1a96 |
20
.github/workflows/phpunit.yml
vendored
Normal file
20
.github/workflows/phpunit.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
name: PHPUnit
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: php-actions/composer@v5
|
||||
|
||||
- name: PHPUnit Tests
|
||||
uses: php-actions/phpunit@v2
|
||||
with:
|
||||
php_extensions: xdebug mbstring
|
||||
bootstrap: vendor/autoload.php
|
||||
configuration: phpunit.xml
|
||||
args: --coverage-text
|
||||
@@ -7,9 +7,6 @@ env:
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- php: 7.1
|
||||
- php: 7.1
|
||||
env: setup=lowest
|
||||
- php: 7.2
|
||||
- php: 7.2
|
||||
env: setup=lowest
|
||||
|
||||
@@ -9,10 +9,11 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"ext-json": "*"
|
||||
"ext-json": "*",
|
||||
"php": "^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"orchestra/testbench": "^3.7"
|
||||
"orchestra/testbench": "^7.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4" : {
|
||||
|
||||
6484
composer.lock
generated
6484
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,19 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/**
|
||||
* Namespace for Laravel Models
|
||||
*/
|
||||
'namespace' => '\\App\\Models\\',
|
||||
|
||||
/**
|
||||
* Path to directory containing JSON files for synchronization
|
||||
*/
|
||||
'path' => base_path('sync'),
|
||||
|
||||
/**
|
||||
* Array of Model names which controls the synchronization order
|
||||
*/
|
||||
'order' => [
|
||||
//
|
||||
],
|
||||
|
||||
27
phpunit.xml
27
phpunit.xml
@@ -1,25 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false">
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false"
|
||||
bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false"
|
||||
stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
||||
<coverage processUncoveredFiles="true">
|
||||
<include>
|
||||
<directory suffix=".php">./src</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory suffix="Test.php">./tests/Unit</directory>
|
||||
</testsuite>
|
||||
|
||||
<testsuite name="Feature">
|
||||
<directory suffix="Test.php">./tests/Feature</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">./src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
|
||||
24
src/Console/Commands/Export.php
Normal file
24
src/Console/Commands/Export.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace nullthoughts\LaravelDataSync\Console\Commands;
|
||||
|
||||
use nullthoughts\LaravelDataSync\Exporter;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class Export extends Command
|
||||
{
|
||||
protected $signature = 'data:export {model} {--criteria=*} {--except=*} {--only=*}';
|
||||
|
||||
protected $description = 'Export Model data for synchronization';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$model = $this->argument('model');
|
||||
|
||||
$this->info('Exporting ' . $model . ' model to sync data file');
|
||||
|
||||
(new Exporter($model, $this->option('criteria'), $this->option('except'), $this->option('only')))->run();
|
||||
|
||||
$this->comment('Export for data sync completed');
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ class DataSyncBaseServiceProvider extends ServiceProvider
|
||||
{
|
||||
$this->commands([
|
||||
Console\Commands\Sync::class,
|
||||
Console\Commands\Export::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
96
src/Exporter.php
Normal file
96
src/Exporter.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace nullthoughts\LaravelDataSync;
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use nullthoughts\LaravelDataSync\Exceptions\FileDirectoryNotFoundException;
|
||||
|
||||
class Exporter
|
||||
{
|
||||
private $modelName;
|
||||
|
||||
private $criteria;
|
||||
|
||||
private $except;
|
||||
|
||||
private $only;
|
||||
|
||||
/**
|
||||
* Get files in sync directory.
|
||||
*
|
||||
* @param string $model
|
||||
* @param array $criteria
|
||||
*
|
||||
* @throws \nullthoughts\LaravelDataSync\Exceptions\FileDirectoryNotFoundException
|
||||
*/
|
||||
public function __construct(string $modelName, array $criteria = [], $except = [], $only = [])
|
||||
{
|
||||
$this->modelName = $modelName;
|
||||
$this->criteria = $criteria;
|
||||
$this->except = $except;
|
||||
$this->only = $only;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export Model data to sync file.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$class = config('data-sync.namespace', '\\App\\Models\\') . $this->modelName;
|
||||
$filename = $this->getDirectory() . '/' . $this->modelName . '.json';
|
||||
$data = $this->prepareData($class);
|
||||
|
||||
file_put_contents($filename, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get directory path for sync files.
|
||||
*
|
||||
* @throws \nullthoughts\LaravelDataSync\Exceptions\FileDirectoryNotFoundException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getDirectory()
|
||||
{
|
||||
$directory = config('data-sync.path', base_path('sync'));
|
||||
|
||||
if (! file_exists($directory)) {
|
||||
throw new FileDirectoryNotFoundException();
|
||||
}
|
||||
|
||||
return $directory;
|
||||
}
|
||||
|
||||
protected function prepareData($class)
|
||||
{
|
||||
$class = new $class;
|
||||
$keys = $this->prepareKeys($class);
|
||||
|
||||
return $class->select($keys)->get()->toJson();
|
||||
}
|
||||
|
||||
protected function prepareKeys($class)
|
||||
{
|
||||
$keys = Schema::getColumnListing($class->getTable());
|
||||
|
||||
if ($this->only) {
|
||||
$keys = array_intersect($keys, $this->only);
|
||||
}
|
||||
|
||||
if ($this->except) {
|
||||
$keys = array_diff($keys, $this->except);
|
||||
}
|
||||
|
||||
|
||||
return collect($keys)->map(function ($key) {
|
||||
if (in_array($key, $this->criteria)) {
|
||||
return $key . ' as _' . $key;
|
||||
}
|
||||
|
||||
return $key;
|
||||
})->toArray();
|
||||
}
|
||||
}
|
||||
121
src/Updater.php
121
src/Updater.php
@@ -2,29 +2,71 @@
|
||||
|
||||
namespace nullthoughts\LaravelDataSync;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use nullthoughts\LaravelDataSync\Exceptions\ErrorUpdatingModelException;
|
||||
use nullthoughts\LaravelDataSync\Exceptions\FileDirectoryNotFoundException;
|
||||
use nullthoughts\LaravelDataSync\Exceptions\NoCriteriaException;
|
||||
use nullthoughts\LaravelDataSync\Exceptions\NoRecordsInvalidJSONException;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Str;
|
||||
use stdClass;
|
||||
|
||||
class Updater
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $directory;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Support\Collection
|
||||
*/
|
||||
private $files;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $remote;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $disk;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $modelNamespace;
|
||||
|
||||
/**
|
||||
* Get files in sync directory.
|
||||
*
|
||||
* @param string|null $path
|
||||
* @param string|null $model
|
||||
* @param string|null $path
|
||||
* @param string|null $model
|
||||
*
|
||||
* @param bool $remote
|
||||
* @param string $disk
|
||||
*
|
||||
* @throws \nullthoughts\LaravelDataSync\Exceptions\FileDirectoryNotFoundException
|
||||
*/
|
||||
public function __construct($path = null, $model = null)
|
||||
public function __construct($path = null, $model = null, $remote = false, $disk = 's3')
|
||||
{
|
||||
$directory = $this->getDirectory($path);
|
||||
$this->files = $this->getFiles($directory, $model);
|
||||
$this->remote = $remote;
|
||||
$this->disk = $disk;
|
||||
$this->modelNamespace = config('data-sync.namespace', '\\App\\Models\\');
|
||||
|
||||
$this->directory = $this->getDirectory($path);
|
||||
$this->files = $this->getFiles($this->directory, $model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the default namespace for the class.
|
||||
*
|
||||
* @param $namespace
|
||||
*/
|
||||
public function setNamespace($namespace)
|
||||
{
|
||||
$this->modelNamespace = $namespace;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,11 +92,11 @@ class Updater
|
||||
/**
|
||||
* Parse each record for criteria/values and update/create model.
|
||||
*
|
||||
* @param string $file
|
||||
*
|
||||
* @throws \nullthoughts\LaravelDataSync\Exceptions\NoRecordsInvalidJSONException
|
||||
* @param string $file
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
* @throws \nullthoughts\LaravelDataSync\Exceptions\NoRecordsInvalidJSONException
|
||||
*/
|
||||
protected function syncModel(string $file)
|
||||
{
|
||||
@@ -89,7 +131,7 @@ class Updater
|
||||
{
|
||||
$directory = $path ?? config('data-sync.path', base_path('sync'));
|
||||
|
||||
if (!file_exists($directory)) {
|
||||
if ($this->directoryMissingLocally($directory) || $this->directoryMissingRemotely($directory)) {
|
||||
throw new FileDirectoryNotFoundException();
|
||||
}
|
||||
|
||||
@@ -110,10 +152,17 @@ class Updater
|
||||
return Collection::wrap($directory.'/'.$model.'.json');
|
||||
}
|
||||
|
||||
return collect(File::files($directory))
|
||||
$files = ($this->remote) ? Storage::disk($this->disk)->files($directory) : File::files($directory);
|
||||
|
||||
return collect($files)
|
||||
->filter(function ($file) {
|
||||
return pathinfo($file, PATHINFO_EXTENSION) == 'json';
|
||||
})->map(function ($path) {
|
||||
|
||||
if (is_string($path)) {
|
||||
return $path;
|
||||
}
|
||||
|
||||
return $path->getPathname();
|
||||
});
|
||||
}
|
||||
@@ -146,13 +195,13 @@ class Updater
|
||||
/**
|
||||
* Filter record criteria.
|
||||
*
|
||||
* @param stdClass $record
|
||||
* @param object $record
|
||||
*
|
||||
* @throws \nullthoughts\LaravelDataSync\Exceptions\NoCriteriaException
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
protected function getCriteria(stdClass $record)
|
||||
protected function getCriteria(object $record)
|
||||
{
|
||||
$criteria = collect($record)->filter(function ($value, $key) {
|
||||
return $this->isCriteria($key);
|
||||
@@ -170,11 +219,11 @@ class Updater
|
||||
/**
|
||||
* Filter record values.
|
||||
*
|
||||
* @param stdClass $record
|
||||
* @param object $record
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
protected function getValues(stdClass $record)
|
||||
protected function getValues(object $record)
|
||||
{
|
||||
return collect($record)->reject(function ($value, $key) {
|
||||
if ($this->isCriteria($key)) {
|
||||
@@ -198,21 +247,23 @@ class Updater
|
||||
*/
|
||||
protected function getModel(string $name)
|
||||
{
|
||||
return '\\App\\'.Str::studly(pathinfo($name, PATHINFO_FILENAME));
|
||||
return $this->modelNamespace . Str::studly(pathinfo($name, PATHINFO_FILENAME));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses JSON from file and returns collection.
|
||||
*
|
||||
* @param string $file
|
||||
*
|
||||
* @throws \nullthoughts\LaravelDataSync\Exceptions\NoRecordsInvalidJSONException
|
||||
* @param string $file
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
* @throws \nullthoughts\LaravelDataSync\Exceptions\NoRecordsInvalidJSONException
|
||||
*/
|
||||
protected function getRecords(string $file)
|
||||
{
|
||||
$records = collect(json_decode(File::get($file)));
|
||||
$fetchedFile = ($this->remote) ? Storage::disk($this->disk)->get($file) : File::get($file);
|
||||
|
||||
$records = collect(json_decode($fetchedFile));
|
||||
|
||||
if ($records->isEmpty()) {
|
||||
throw new NoRecordsInvalidJSONException($file);
|
||||
@@ -237,11 +288,11 @@ class Updater
|
||||
* Return ID for nested key-value pairs.
|
||||
*
|
||||
* @param string $key
|
||||
* @param stdClass $values
|
||||
* @param object $values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function resolveId(string $key, stdClass $values)
|
||||
protected function resolveId(string $key, object $values)
|
||||
{
|
||||
$model = $this->getModel($key);
|
||||
|
||||
@@ -273,4 +324,24 @@ class Updater
|
||||
return [$key => $value];
|
||||
})->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Config\Repository $directory
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function directoryMissingLocally($directory)
|
||||
{
|
||||
return !$this->remote && !file_exists($directory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Config\Repository $directory
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function directoryMissingRemotely($directory)
|
||||
{
|
||||
return $this->remote && !Storage::disk($this->disk)->exists($directory);
|
||||
}
|
||||
}
|
||||
|
||||
160
tests/Unit/UpdaterRemoteTest.php
Normal file
160
tests/Unit/UpdaterRemoteTest.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
|
||||
namespace nullthoughts\LaravelDataSync\Tests;
|
||||
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use nullthoughts\LaravelDataSync\Exceptions\ErrorUpdatingModelException;
|
||||
use nullthoughts\LaravelDataSync\Tests\fakes\UpdaterFake;
|
||||
use Exception;
|
||||
|
||||
class UpdaterRemoteTest extends TestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
Storage::fake('s3');
|
||||
Storage::disk('s3')->put('test-data/roles.json', File::get(__DIR__.'/../test-data/roles.json'));
|
||||
foreach (File::directories(__DIR__.'/../test-data/') as $directory) {
|
||||
$files = File::files($directory);
|
||||
|
||||
foreach ($files as $file) {
|
||||
Storage::disk('s3')->put('test-data/'.basename($directory).'/'.$file->getRelativePathname(), File::get($file->getPathname()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_adds_roles_to_the_database_in_remote()
|
||||
{
|
||||
$updater = new UpdaterFake('test-data', 'roles', true, 's3');
|
||||
|
||||
$updater->run();
|
||||
|
||||
$this->assertDatabaseHas('roles', ['slug' => 'update-student-records']);
|
||||
$this->assertDatabaseHas('roles', ['slug' => 'borrow-ferrari']);
|
||||
$this->assertDatabaseHas('roles', ['slug' => 'destroy-ferrari']);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_can_default_to_configuration_in_remote()
|
||||
{
|
||||
config()->set('data-sync.path', 'test-data');
|
||||
|
||||
$updater = new UpdaterFake(null, null, true, 's3');
|
||||
|
||||
$updater->run();
|
||||
|
||||
$this->assertDatabaseHas('roles', ['slug' => 'update-student-records']);
|
||||
$this->assertDatabaseHas('roles', ['slug' => 'borrow-ferrari']);
|
||||
$this->assertDatabaseHas('roles', ['slug' => 'destroy-ferrari']);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_can_update_an_existing_record_in_remote()
|
||||
{
|
||||
config()->set('data-sync.path', 'test-data');
|
||||
(new UpdaterFake(null, null, true, 's3'))->run();
|
||||
|
||||
config()->set('data-sync.path', 'test-data/valid');
|
||||
(new UpdaterFake(null, null, true, 's3'))->run();
|
||||
|
||||
$this->assertDatabaseHas('roles', ['category' => 'changed']);
|
||||
$this->assertDatabaseHas('roles', ['category' => 'changed']);
|
||||
$this->assertDatabaseHas('roles', ['category' => 'changed']);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_can_update_the_relationship_in_remote()
|
||||
{
|
||||
$supervisor = Supervisor::create([
|
||||
'name' => 'CEO',
|
||||
]);
|
||||
|
||||
config()->set('data-sync.path', 'test-data/relationship');
|
||||
(new UpdaterFake(null, null, true, 's3'))->run();
|
||||
|
||||
$this->assertEquals($supervisor->id, Roles::first()->supervisor_id);
|
||||
$this->assertTrue($supervisor->is(Roles::first()->supervisor));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @group current
|
||||
*/
|
||||
public function exception_is_thrown_if_the_directory_does_not_exists()
|
||||
{
|
||||
try {
|
||||
new UpdaterFake(null, null, true, 's3');
|
||||
|
||||
$this->fail('exception was thrown');
|
||||
} catch (Exception $e) {
|
||||
$this->assertEquals('Specified sync file directory does not exist', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function invalid_json_throws_an_exception_in_remote()
|
||||
{
|
||||
try {
|
||||
$updater = new UpdaterFake('test-data/invalid-json', null, true, 's3');
|
||||
$updater->run();
|
||||
|
||||
$this->fail('exception was thrown');
|
||||
} catch (Exception $e) {
|
||||
$this->assertStringContainsString('No records or invalid JSON for', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function the_json_must_contain_a_key_with_an_underscore_in_remote()
|
||||
{
|
||||
try {
|
||||
$updater = new UpdaterFake('test-data/no-criteria', null, true, 's3');
|
||||
$updater->run();
|
||||
|
||||
$this->fail('exception was thrown');
|
||||
} catch (Exception $e) {
|
||||
$this->assertEquals('No criteria/attributes detected', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function order_of_imports_can_be_defined_in_config_in_remote()
|
||||
{
|
||||
config()->set('data-sync.order', [
|
||||
'Supervisor',
|
||||
'Roles',
|
||||
]);
|
||||
|
||||
$updater = new UpdaterFake('test-data/ordered', null, true, 's3');
|
||||
$updater->run();
|
||||
|
||||
$this->assertDatabaseHas('roles', ['slug' => 'update-student-records']);
|
||||
$this->assertDatabaseHas('supervisors', ['name' => 'CEO']);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function exception_is_thrown_if_imports_are_in_incorrect_order_in_remote()
|
||||
{
|
||||
config()->set('data-sync.order', [
|
||||
'Roles',
|
||||
'Supervisor',
|
||||
]);
|
||||
|
||||
$this->expectException(ErrorUpdatingModelException::class);
|
||||
|
||||
$updater = new UpdaterFake('test-data/ordered', null, true, 's3');
|
||||
$updater->run();
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_ignores_non_json_files_in_remote()
|
||||
{
|
||||
$updater = new UpdaterFake('test-data/not-json', null, true, 's3');
|
||||
$updater->run();
|
||||
|
||||
$this->assertDatabaseMissing('roles', ['slug' => 'update-student-records']);
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class UpdaterTest extends TestCase
|
||||
|
||||
$this->fail('exception was thrown');
|
||||
} catch (Exception $e) {
|
||||
$this->assertContains('No records or invalid JSON for', $e->getMessage());
|
||||
$this->assertStringContainsString('No records or invalid JSON for', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user