fix: 🚨 resolve phpcs errors
This commit is contained in:
parent
b3fb0301f8
commit
1aaadb88d0
65 changed files with 292 additions and 296 deletions
|
|
@ -155,7 +155,7 @@ class Handler extends ExceptionHandler
|
|||
// @codeCoverageIgnoreStart
|
||||
if (config('app.env') === 'testing') {
|
||||
// phpcs:ignore Squiz.PHP.DiscouragedFunctions.Found
|
||||
print_r((string)$e);
|
||||
print_r((string) $e);
|
||||
}
|
||||
return $this->getReponse($request, 500, \intval($e->getCode()), $e->getMessage());
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
|
@ -181,12 +181,12 @@ class Handler extends ExceptionHandler
|
|||
if (Helper::isRequestForApiV2($request)) {
|
||||
return (new V2ApiResponse(
|
||||
ApiStatus::KO,
|
||||
(object)array_merge($data, ['message' => $message, 'code' => $apiCode]),
|
||||
(object) array_merge($data, ['message' => $message, 'code' => $apiCode]),
|
||||
))->toResponse($request)->setStatusCode($httpCode);
|
||||
}
|
||||
return (new V4ApiResponse(
|
||||
ApiStatus::KO,
|
||||
(object)array_merge($data, ['message' => $message, 'code' => $apiCode]),
|
||||
(object) array_merge($data, ['message' => $message, 'code' => $apiCode]),
|
||||
))->toResponse($request)->setStatusCode($httpCode);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class CustomerController extends Controller
|
|||
*/
|
||||
public function store(StoreCustomerRequest $request, Service $service): JsonResource
|
||||
{
|
||||
$data = (object)$request->validated();
|
||||
$data = (object) $request->validated();
|
||||
|
||||
/** @var \App\Models\Customer */
|
||||
$customer = Customer::query()->where('email', $data->email)->firstOrCreate([
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class CustomerController extends Controller
|
|||
*/
|
||||
public function store(StoreCustomerRequest $request, Service $service): JsonResource
|
||||
{
|
||||
$data = (object)$request->validated();
|
||||
$data = (object) $request->validated();
|
||||
|
||||
/** @var \App\Models\Customer */
|
||||
$customer = Customer::query()->where('email', $data->email)->firstOrCreate([
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ class BrandController extends Controller
|
|||
$models = CollectionHelper::paginateManually(
|
||||
Brand::getUserAssociatedBrands(),
|
||||
$this->jsonItemPerPagination,
|
||||
(int)$request->validated('page'),
|
||||
(int) $request->validated('page'),
|
||||
);
|
||||
return \response()->json($models);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class StatsController extends Controller
|
|||
}
|
||||
$w->insertOne($cols);
|
||||
}
|
||||
return response((string)$w, 200, [
|
||||
return response((string) $w, 200, [
|
||||
'Content-Encoding' => 'none',
|
||||
'Content-Type' => 'text/csv; charset=UTF-8',
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
|
|
@ -135,7 +135,7 @@ class StatsController extends Controller
|
|||
$dayAnswers->values()->all()
|
||||
));
|
||||
}
|
||||
return response((string)$w, 200, [
|
||||
return response((string) $w, 200, [
|
||||
'Content-Encoding' => 'none',
|
||||
'Content-Type' => 'text/csv; charset=UTF-8',
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ class ApiResponse
|
|||
$status = intval($response->getStatusCode() / 100) == 2 ? ApiStatus::OK : ApiStatus::KO;
|
||||
|
||||
if (Helper::isRequestForApiV2($request)) {
|
||||
return $response->setData(new V2ApiResponse($status, (object)$data));
|
||||
return $response->setData(new V2ApiResponse($status, (object) $data));
|
||||
}
|
||||
return $response->setData(new V4ApiResponse($status, (object)$data));
|
||||
return $response->setData(new V4ApiResponse($status, (object) $data));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,11 +100,11 @@ abstract class UpdateMiniCrudRequest extends FormRequest
|
|||
}) : $input['dimensions'];
|
||||
|
||||
// * Adapt dimensions
|
||||
$sizes = (object)[
|
||||
$sizes = (object) [
|
||||
'minHeight' => $dim['height'],
|
||||
'maxHeight' => $dim['height'],
|
||||
'minWith' => $dim['width'],
|
||||
'maxWith' => $dim['width'],
|
||||
'minWith' => $dim['width'],
|
||||
'maxWith' => $dim['width'],
|
||||
];
|
||||
$rules = array_merge($rules, [
|
||||
"data.$iptName.value" => [
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class ApiResponse extends JsonResource
|
|||
//phpcs:enable
|
||||
return [
|
||||
'status' => $this->status->value(),
|
||||
'data' => (array)($this->data ?? []),
|
||||
'data' => (array) ($this->data ?? []),
|
||||
'version' => '3.0.6'
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class ApiResponse extends JsonResource
|
|||
//phpcs:enable
|
||||
return [
|
||||
'status' => $this->status->value(),
|
||||
'data' => (array)($this->data ?? []),
|
||||
'data' => (array) ($this->data ?? []),
|
||||
'version' => config('api.version')
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ class ToolboxHelper
|
|||
{
|
||||
// Only process if it's an object or array being passed to the function.
|
||||
if (is_object($input) or is_array($input)) {
|
||||
$ret = (array)$input;
|
||||
$ret = (array) $input;
|
||||
foreach ($ret as &$item) {
|
||||
// Recursively process EACH element only if not scalar.
|
||||
$item = (is_object($item) or is_array($item)) ?
|
||||
|
|
@ -392,7 +392,7 @@ class ToolboxHelper
|
|||
{
|
||||
// Only process if it's an object or array being passed to the function.
|
||||
if (is_object($input) or is_array($input)) {
|
||||
$ret = (object)$input;
|
||||
$ret = (object) $input;
|
||||
foreach ($ret as &$item) {
|
||||
// Recursively process EACH element only if not scalar.
|
||||
$item = (is_object($item) or is_array($item)) ?
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'debug' => (bool)env('APP_DEBUG', false),
|
||||
'debug' => (bool) env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ return [
|
|||
'send_default_pii' => env('SENTRY_SEND_DEFAULT_PII', false),
|
||||
|
||||
// @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#traces-sample-rate.
|
||||
'traces_sample_rate' => env('SENTRY_TRACES_SAMPLE_RATE') === null ? null : (float)env('SENTRY_TRACES_SAMPLE_RATE'),
|
||||
'traces_sample_rate' => env('SENTRY_TRACES_SAMPLE_RATE') === null ? null : (float) env('SENTRY_TRACES_SAMPLE_RATE'),
|
||||
|
||||
'before_send' => [\App\Lib\Helpers\ExceptionsHelper::class, 'sentryEventHandler'],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -29,8 +29,8 @@ class CreateUsersTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateFailedJobsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -30,8 +29,8 @@ class CreateFailedJobsTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateCustomers extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('customers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -26,8 +25,8 @@ class CreateCustomers extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('customers');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateBrands extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('brands', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -26,8 +25,8 @@ class CreateBrands extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('brands');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateCustomerInfos extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('customer_infos', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -38,8 +37,8 @@ class CreateCustomerInfos extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('customer_infos');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateCustomerLogin extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('customer_login', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -30,8 +29,8 @@ class CreateCustomerLogin extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('customer_login');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateSingleOptin extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('single_optin', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -27,8 +26,8 @@ class CreateSingleOptin extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('single_optin');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateCustomerOptInHistory extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('customer_opt_in_history', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -28,8 +27,8 @@ class CreateCustomerOptInHistory extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('customer_opt_in_history');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateServices extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('services', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -29,8 +28,8 @@ class CreateServices extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('services');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateServicesStats extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('services_stats', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -29,8 +28,8 @@ class CreateServicesStats extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('services_stats');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class RenameServicesStatsTableToServiceStats extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::rename('services_stats', 'service_stats');
|
||||
}
|
||||
|
|
@ -22,8 +20,8 @@ class RenameServicesStatsTableToServiceStats extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::rename('service_stats', 'services_stats');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class RenameSingleOptinToSingleOptins extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::rename('single_optin', 'single_optins');
|
||||
}
|
||||
|
|
@ -22,8 +20,8 @@ class RenameSingleOptinToSingleOptins extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::rename('single_optins', 'single_optin');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class RenameCustomerLoginToOptinToCustomerLogins extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::rename('customer_login', 'customer_logins');
|
||||
}
|
||||
|
|
@ -22,8 +20,8 @@ class RenameCustomerLoginToOptinToCustomerLogins extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::rename('customer_logins', 'customer_login');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class ChangeForeignKeysToCascadeOnCustomerDelete extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
Schema::table('customer_infos', function (Blueprint $table) {
|
||||
|
|
@ -39,7 +38,7 @@ class ChangeForeignKeysToCascadeOnCustomerDelete extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
Schema::table('customer_infos', function (Blueprint $table) {
|
||||
|
|
@ -60,4 +59,4 @@ class ChangeForeignKeysToCascadeOnCustomerDelete extends Migration
|
|||
});
|
||||
Schema::enableForeignKeyConstraints();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class RenameApiTokenOnServicesTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->renameColumn('api_token', 'bearer_token');
|
||||
|
|
@ -25,11 +24,11 @@ class RenameApiTokenOnServicesTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->renameColumn('bearer_token', 'api_token');
|
||||
$table->renameColumn('bearer_token_date', 'api_token_date');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,18 +2,16 @@
|
|||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class ReAddApiTokenToServicesTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->string('api_token')->nullable()->after('bearer_token_date');
|
||||
|
|
@ -26,7 +24,7 @@ class ReAddApiTokenToServicesTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->dropColumn('api_token');
|
||||
|
|
@ -35,4 +33,4 @@ class ReAddApiTokenToServicesTable extends Migration
|
|||
$table->dropColumn('api_token_date');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddBearerPwdToServicesTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->string('bearer_pwd')->after('bearer_token');
|
||||
|
|
@ -23,10 +23,10 @@ class AddBearerPwdToServicesTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->dropColumn('bearer_pwd');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddNewcountryColumnToCustomerInfosTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('customer_infos', function (Blueprint $table) {
|
||||
$table->smallInteger('newcountry')->default(76)->after('country');
|
||||
|
|
@ -23,10 +23,10 @@ class AddNewcountryColumnToCustomerInfosTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('customer_infos', function (Blueprint $table) {
|
||||
$table->dropColumn('newcountry');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,19 +4,20 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateQuestionsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('questions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->text('question');
|
||||
$table->tinyInteger('type'); // QuestionType
|
||||
// QuestionType.
|
||||
$table->tinyInteger('type');
|
||||
$table->foreignId('brand_id')->constrained('brands');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
@ -27,8 +28,8 @@ class CreateQuestionsTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('questions');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAnswersTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('answers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -26,8 +26,8 @@ class CreateAnswersTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('answers');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCustomerAnswerTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('customer_answer', function (Blueprint $table) {
|
||||
$table->foreignId('answer_id')->constrained('answers');
|
||||
|
|
@ -25,8 +25,8 @@ class CreateCustomerAnswerTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('customer_answer');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use App\Models\Service;
|
|||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class HashApiKeysInServicesTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
foreach (Service::all() as $service) {
|
||||
$service->bearer_token = Hash::make($service->bearer_token);
|
||||
|
|
@ -24,7 +24,8 @@ class HashApiKeysInServicesTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateJobsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
|
|
@ -29,8 +29,8 @@ class CreateJobsTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,32 +4,32 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateBrandStatsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('brand_stats', function (Blueprint $table) {
|
||||
// Le nombre de comptes actifs (dernière connexion inférieure à 6 mois)
|
||||
// Le nombre de comptes actifs (dernière connexion inférieure à 6 mois).
|
||||
$table->unsignedInteger('active');
|
||||
|
||||
// Le nombre de comptes inactifs (dernière connexion supérieure à 6 mois)
|
||||
// Le nombre de comptes inactifs (dernière connexion supérieure à 6 mois).
|
||||
$table->unsignedInteger('inactive');
|
||||
|
||||
// Le nombre d’anciens comptes (date de création supérieure à 6 mois
|
||||
// Le nombre d’anciens comptes (date de création supérieure à 6 mois.
|
||||
$table->unsignedInteger('old_accounts');
|
||||
|
||||
// Le nombre de nouveaux comptes (date de création inférieure à 6 mois)
|
||||
// Le nombre de nouveaux comptes (date de création inférieure à 6 mois).
|
||||
$table->unsignedInteger('new_accounts');
|
||||
|
||||
// Le nombre de comptes total
|
||||
// Le nombre de comptes total.
|
||||
$table->unsignedInteger('total_accounts');
|
||||
|
||||
// Le nombre d’optins (single optin compris)
|
||||
// Le nombre d’optins (single optin compris).
|
||||
$table->unsignedInteger('total_opt_in');
|
||||
|
||||
$table->timestamp('created_at')->nullable();
|
||||
|
|
@ -45,8 +45,8 @@ class CreateBrandStatsTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('brand_stats');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RepairStatsJobs extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
$jobIDS = [];
|
||||
$page = 1;
|
||||
|
|
@ -44,8 +44,8 @@ class RepairStatsJobs extends Migration
|
|||
}
|
||||
$serviceStat->nb_calls += 1;
|
||||
$serviceStat->saveOrFail();
|
||||
}
|
||||
}
|
||||
} //end if
|
||||
} //end foreach
|
||||
DB::table('jobs')->whereIn('id', $jobIDS)
|
||||
->delete();
|
||||
$jobIDS = [];
|
||||
|
|
@ -57,8 +57,8 @@ class RepairStatsJobs extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
//
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropApiTokenFromServices extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->dropColumn('api_token');
|
||||
|
|
@ -24,11 +24,11 @@ class DropApiTokenFromServices extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->string('api_token')->nullable()->after('bearer_token_date');
|
||||
$table->timestamp('api_token_date')->after('api_token')->useCurrent();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class SetUniqueConstrainOnApiTokenOnServices extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->unique('bearer_token');
|
||||
|
|
@ -23,10 +23,10 @@ class SetUniqueConstrainOnApiTokenOnServices extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->dropUnique(['bearer_token']);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class IncreaseBearerPwdOnServices extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->string('bearer_pwd', 312)->change();
|
||||
|
|
@ -23,9 +23,9 @@ class IncreaseBearerPwdOnServices extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
// Dont revert this, could break things with truncated
|
||||
// columns, wont harm.
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@ use Illuminate\Support\Facades\DB;
|
|||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ParseCountryOnCustomerInfos extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
$perPage = 10000;
|
||||
$currentPage = 0;
|
||||
|
|
@ -56,8 +56,8 @@ class ParseCountryOnCustomerInfos extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class SetCustomerIdNullableOnCustomerAnswer extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
Schema::table('customer_answer', function (Blueprint $table) {
|
||||
|
|
@ -28,7 +28,7 @@ class SetCustomerIdNullableOnCustomerAnswer extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
Schema::table('customer_answer', function (Blueprint $table) {
|
||||
|
|
@ -39,4 +39,4 @@ class SetCustomerIdNullableOnCustomerAnswer extends Migration
|
|||
});
|
||||
Schema::enableForeignKeyConstraints();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CascadeDeleteQuestionAnswers extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
// * Add cascade delete
|
||||
Schema::table('answers', function (Blueprint $table) {
|
||||
|
|
@ -25,7 +25,7 @@ class CascadeDeleteQuestionAnswers extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
// * Undo cascade delete (restrict as default)
|
||||
Schema::table('answers', function (Blueprint $table) {
|
||||
|
|
@ -33,4 +33,4 @@ class CascadeDeleteQuestionAnswers extends Migration
|
|||
$table->foreign('question_id')->references('id')->on('questions');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CascadeDeleteCustomerAnswer extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
// * Add cascade delete
|
||||
Schema::table('customer_answer', function (Blueprint $table) {
|
||||
|
|
@ -25,7 +25,7 @@ class CascadeDeleteCustomerAnswer extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
// * Undo cascade delete (restrict as default)
|
||||
Schema::table('customer_answer', function (Blueprint $table) {
|
||||
|
|
@ -33,4 +33,4 @@ class CascadeDeleteCustomerAnswer extends Migration
|
|||
$table->foreign('answer_id')->references('id')->on('answers');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ use Illuminate\Support\Facades\DB;
|
|||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class AddChangeSingleOptinToUseHashcode extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('single_optins', function (Blueprint $table) {
|
||||
$table->uuid('hashcode')->comment('Single optin hashcode')->after('id');
|
||||
|
|
@ -37,7 +37,7 @@ class AddChangeSingleOptinToUseHashcode extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('single_optins', function (Blueprint $table) {
|
||||
$table->id()->after('hashcode');
|
||||
|
|
@ -46,4 +46,4 @@ class AddChangeSingleOptinToUseHashcode extends Migration
|
|||
$table->dropColumn('hashcode');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class EnhanceCustomerInfosHashcode extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('customer_infos', function (Blueprint $table) {
|
||||
$table->uuid('hashcode')
|
||||
|
|
@ -24,8 +24,8 @@ class EnhanceCustomerInfosHashcode extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
// * No need to undo that.
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
<file>database/seeders</file>
|
||||
<file>routes/</file>
|
||||
<file>tests/</file>
|
||||
<exclude-pattern type="relative">*/vendor/*</exclude-pattern>
|
||||
<rule ref="PSR1" />
|
||||
<rule ref="PSR12" />
|
||||
|
||||
|
|
@ -31,8 +32,7 @@
|
|||
<rule ref="Generic.Files.LineLength"/>
|
||||
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
|
||||
<rule ref="Generic.Formatting.MultipleStatementAlignment"/>
|
||||
<rule ref="Generic.Formatting.NoSpaceAfterCast"/>
|
||||
<rule ref="Generic.Functions.CallTimePassByReference"/>
|
||||
<rule ref="Generic.Formatting.SpaceAfterCast"/>
|
||||
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
|
||||
<rule ref="Generic.Metrics.CyclomaticComplexity"/>
|
||||
<rule ref="Generic.Metrics.NestingLevel"/>
|
||||
|
|
@ -46,9 +46,6 @@
|
|||
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
|
||||
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
|
||||
<rule ref="Generic.WhiteSpace.ScopeIndent"/>
|
||||
<rule ref="MySource.PHP.EvalObjectFactory"/>
|
||||
<rule ref="MySource.PHP.GetRequestData"/>
|
||||
<rule ref="MySource.PHP.AjaxNullComparison"/>
|
||||
<rule ref="PEAR.Classes.ClassDeclaration"/>
|
||||
<rule ref="PEAR.Commenting.InlineComment"/>
|
||||
<rule ref="PSR1.Classes.ClassDeclaration"/>
|
||||
|
|
@ -81,7 +78,7 @@
|
|||
<rule ref="Squiz.Scope.MemberVarScope"/>
|
||||
<rule ref="Squiz.Scope.MethodScope"/>
|
||||
<rule ref="Squiz.Scope.StaticThisUsage"/>
|
||||
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
|
||||
<rule ref="Generic.WhiteSpace.LanguageConstructSpacing"/>
|
||||
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
|
||||
<rule ref="Squiz.WhiteSpace.MemberVarSpacing">
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -24,13 +24,13 @@ class ApiBase extends BaseTestCase
|
|||
* @param \App\Enums\ApiStatus $status
|
||||
* @return void
|
||||
*/
|
||||
protected function assertApiResponseStatusIs(AssertableJsonString $json, ApiStatus $status)
|
||||
protected function assertApiResponseStatusIs(AssertableJsonString $json, ApiStatus $status): void
|
||||
{
|
||||
$json->assertFragment(['status' => $status->value()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Raw Function to call api
|
||||
* Raw Function to call api.
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $uri
|
||||
|
|
@ -51,7 +51,7 @@ class ApiBase extends BaseTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* Raw Function to call api with Token
|
||||
* Raw Function to call api with Token.
|
||||
*
|
||||
* @param \App\Models\Service $service
|
||||
* @param string $method
|
||||
|
|
@ -81,7 +81,7 @@ class ApiBase extends BaseTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Customer models with given status (active or not)
|
||||
* Get Customer models with given status (active or not).
|
||||
*
|
||||
* @param boolean $status The customer status for a brand.
|
||||
* @param boolean $random Randomize the customer to get.
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class ArcadiaTest extends ApiBase
|
|||
'order_date' => date('Y/m/d H:i:s'),
|
||||
'support_code' => 32,
|
||||
'label_type_support' => 'Jeux Reghalal',
|
||||
'code_unique' => \strtoupper(\str_replace('-', '', (string)Str::uuid())),
|
||||
'code_unique' => \strtoupper(\str_replace('-', '', (string) Str::uuid())),
|
||||
'code_on_pack' => '2563547'
|
||||
];
|
||||
$response = $this->callApiWithToken($service, 'post', route(
|
||||
|
|
|
|||
|
|
@ -639,7 +639,7 @@ class CustomerTest extends ApiBase
|
|||
});
|
||||
|
||||
$this->assertTrue(
|
||||
(bool)$customer->logins()->count(),
|
||||
(bool) $customer->logins()->count(),
|
||||
'This test assumes customer belongs to multiple brand.'
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class ArcadiaTest extends ApiBase
|
|||
'order_date' => date('Y/m/d H:i:s'),
|
||||
'support_code' => 32,
|
||||
'label_type_support' => 'Jeux Reghalal',
|
||||
'code_unique' => \strtoupper(\str_replace('-', '', (string)Str::uuid())),
|
||||
'code_unique' => \strtoupper(\str_replace('-', '', (string) Str::uuid())),
|
||||
'code_on_pack' => '2563547'
|
||||
];
|
||||
$response = $this->callApiWithToken($service, 'post', route(
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use App\Models\ClaimSubject;
|
|||
use App\Models\Customer;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class ClaimTest extends ApiBase
|
||||
{
|
||||
|
|
@ -66,6 +67,14 @@ class ClaimTest extends ApiBase
|
|||
$json = $response->decodeResponseJson();
|
||||
$this->assertApiResponseStatusIs($json, ApiStatus::OK);
|
||||
$this->assertTrue($claimModel, 'Claim should have been stored.');
|
||||
|
||||
// Assert file stored.
|
||||
$claimModel = Claim::query()->where('email', 'claim@hotmail.fr')->firstOrFail();
|
||||
$this->assertNotEmpty($claimModel->file, 'The "file" field is empty on the Claim model.');
|
||||
$this->assertTrue(
|
||||
Storage::exists(ltrim($claimModel->file, '/')),
|
||||
"The file does not exist: {$claimModel->file}"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -100,8 +109,7 @@ class ClaimTest extends ApiBase
|
|||
public function testSendClaimWithoutOptionnalFieldsShouldWork(): void
|
||||
{
|
||||
extract($this->getCustomer(true, false));
|
||||
$subject = ClaimSubject::query()->firstOrNew();
|
||||
$customer = Customer::query()->firstOrNew();
|
||||
$subject = ClaimSubject::query()->firstOrNew();
|
||||
|
||||
$response = $this->callApiWithToken($service, 'post', route('apiV4.claim.store'), \array_merge(
|
||||
Arr::except($this->skeleton, ['address', 'city', 'postcode', 'file']),
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class CustomerTest extends ApiBase
|
|||
use DatabaseTransactions;
|
||||
|
||||
/**
|
||||
* Test Customer relations to its related models
|
||||
* Test Customer relations to its related models.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -172,7 +172,7 @@ class CustomerTest extends ApiBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Customer store ok
|
||||
* Customer store ok.
|
||||
* route: apiV4.customers.store
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -639,7 +639,7 @@ class CustomerTest extends ApiBase
|
|||
});
|
||||
|
||||
$this->assertTrue(
|
||||
(bool)$customer->logins()->count(),
|
||||
(bool) $customer->logins()->count(),
|
||||
'This test assumes customer belongs to multiple brand.'
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testArcadiaSendOrderDefault()
|
||||
public function testArcadiaSendOrderDefault(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$customer = $api->getCustomerOrNew(static::$info->hashcode);
|
||||
|
|
@ -44,11 +44,11 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Test arcadia default mail can serialize to json
|
||||
* Test arcadia default mail can serialize to json.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testArcadiaOrderDefaultJson()
|
||||
public function testArcadiaOrderDefaultJson(): void
|
||||
{
|
||||
$data = [
|
||||
'email' => static::$customer->email,
|
||||
|
|
@ -95,7 +95,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testArcadiaSendOrderGame()
|
||||
public function testArcadiaSendOrderGame(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$customer = $api->getCustomerOrNew(static::$info->hashcode);
|
||||
|
|
@ -112,7 +112,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
'order_date' => date('Y/m/d H:i:s'),
|
||||
'support_code' => 32,
|
||||
'label_type_support' => 'Jeux Reghalal',
|
||||
'code_unique' => \strtoupper(\str_replace('-', '', (string)Str::uuid())),
|
||||
'code_unique' => \strtoupper(\str_replace('-', '', (string) Str::uuid())),
|
||||
'code_on_pack' => '12365214587562'
|
||||
]);
|
||||
$this->assertTrue($arcadiaOrderMail->send($customer));
|
||||
|
|
@ -123,7 +123,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testArcadiaSendOrderGameNullString()
|
||||
public function testArcadiaSendOrderGameNullString(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$customer = $api->getCustomerOrNew(static::$info->hashcode);
|
||||
|
|
@ -147,11 +147,11 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Test arcadia game mail can serialize to json
|
||||
* Test arcadia game mail can serialize to json.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testArcadiaOrderGameJson()
|
||||
public function testArcadiaOrderGameJson(): void
|
||||
{
|
||||
$data = [
|
||||
'email' => static::$customer->email,
|
||||
|
|
@ -166,7 +166,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
'order_date' => date('Y/m/d H:i:s'),
|
||||
'support_code' => 32,
|
||||
'label_type_support' => 'Jeux Reghalal',
|
||||
'code_unique' => \strtoupper(\str_replace('-', '', (string)Str::uuid())),
|
||||
'code_unique' => \strtoupper(\str_replace('-', '', (string) Str::uuid())),
|
||||
'code_on_pack' => '12365214587562'
|
||||
];
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testValidateGeneratedXmlDefault()
|
||||
public function testValidateGeneratedXmlDefault(): void
|
||||
{
|
||||
$fileFound = false;
|
||||
|
||||
|
|
@ -225,7 +225,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testValidateGeneratedXmlGame()
|
||||
public function testValidateGeneratedXmlGame(): void
|
||||
{
|
||||
$fileFound = false;
|
||||
|
||||
|
|
@ -250,7 +250,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Render a \LibXMLError
|
||||
* Render a \LibXMLError.
|
||||
*
|
||||
* @param \LibXMLError $error
|
||||
* @return string
|
||||
|
|
@ -283,7 +283,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private function libxmlDisplayErrors()
|
||||
private function libxmlDisplayErrors(): void
|
||||
{
|
||||
$errors = libxml_get_errors();
|
||||
foreach ($errors as $error) {
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
namespace Tests\Client;
|
||||
|
||||
use App\Models\Claim as ModelsClaim;
|
||||
use LDC\LDCCRM\Models\Claim;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use LDC\LDCCRM\Exceptions\ValidationException;
|
||||
use LDC\LDCCRM\Models\Claim;
|
||||
|
||||
class CrmClientClaimTest extends CrmClientTester
|
||||
{
|
||||
|
|
@ -16,7 +17,8 @@ class CrmClientClaimTest extends CrmClientTester
|
|||
*/
|
||||
public function testCreateClaim(): void
|
||||
{
|
||||
$image = UploadedFile::fake()->image('photo.jpg');
|
||||
$image = UploadedFile::fake()->image('photo.jpg');
|
||||
$base64 = base64_encode(file_get_contents($image->getRealPath()));
|
||||
$this->assertTrue(Claim::setClaim(
|
||||
'Jean',
|
||||
'Bond',
|
||||
|
|
@ -27,9 +29,16 @@ class CrmClientClaimTest extends CrmClientTester
|
|||
'10 rue des totos',
|
||||
'Le Mans',
|
||||
'72100',
|
||||
base64_encode(file_get_contents($image->getRealPath())),
|
||||
$base64,
|
||||
));
|
||||
$this->assertTrue(ModelsClaim::query()->where('email', 'claim@hotmail.fr')->exists());
|
||||
|
||||
$claimModel = ModelsClaim::query()->where('email', 'claim@hotmail.fr')->firstOrFail();
|
||||
$this->assertNotEmpty($claimModel->file, 'The "file" field is empty on the Claim model.');
|
||||
$this->assertTrue(
|
||||
Storage::exists(ltrim($claimModel->file, '/')),
|
||||
"The file does not exist: {$claimModel->file}"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class CrmClientClientTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiInterface()
|
||||
public function testApiInterface(): void
|
||||
{
|
||||
$routes = $this->getClientRoutes();
|
||||
$interface = new ApiInterface();
|
||||
|
|
@ -37,18 +37,18 @@ class CrmClientClientTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testClientPing()
|
||||
public function testClientPing(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$this->assertTrue($api->ping());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set unknown attribute set
|
||||
* Set unknown attribute set.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCrmModelSetUnknownAttribute()
|
||||
public function testCrmModelSetUnknownAttribute(): void
|
||||
{
|
||||
$this->expectException(AccessError::class);
|
||||
$customer = new Customer();
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ use LDC\LDCCRM\Utils;
|
|||
class CrmClientConfigTest extends CrmClientTester
|
||||
{
|
||||
/**
|
||||
* Test Utils::getConfig
|
||||
* Test Utils::getConfig.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConfigGet()
|
||||
public function testConfigGet(): void
|
||||
{
|
||||
$this->assertEquals(null, Utils::getConfig('totot'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetter()
|
||||
public function testGetter(): void
|
||||
{
|
||||
$this->expectNotToPerformAssertions();
|
||||
$client = new Customer();
|
||||
|
|
@ -29,11 +29,11 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Test set customer prop
|
||||
* Test set customer prop.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSetter()
|
||||
public function testSetter(): void
|
||||
{
|
||||
$this->expectNotToPerformAssertions();
|
||||
$client = new Customer();
|
||||
|
|
@ -47,7 +47,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSetterFailWrongType()
|
||||
public function testSetterFailWrongType(): void
|
||||
{
|
||||
$this->expectException(ValidationException::class);
|
||||
$client = new Customer();
|
||||
|
|
@ -60,7 +60,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSetterFailWrongTypeCountry()
|
||||
public function testSetterFailWrongTypeCountry(): void
|
||||
{
|
||||
$this->expectException(ValidationException::class);
|
||||
$client = new Customer();
|
||||
|
|
@ -73,13 +73,13 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPropsAllSetOk()
|
||||
public function testPropsAllSetOk(): void
|
||||
{
|
||||
$this->expectNotToPerformAssertions();
|
||||
$client = new Customer();
|
||||
|
||||
$propTypes = [
|
||||
'hashcode' => (string)Str::uuid(),
|
||||
'hashcode' => (string) Str::uuid(),
|
||||
'email' => 'toto@gmail.com',
|
||||
'firstname' => 'string',
|
||||
'lastname' => 'string',
|
||||
|
|
@ -105,12 +105,12 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testJsonSerialize()
|
||||
public function testJsonSerialize(): void
|
||||
{
|
||||
$client = new Customer();
|
||||
|
||||
$propTypes = [
|
||||
'hashcode' => (string)Str::uuid(),
|
||||
'hashcode' => (string) Str::uuid(),
|
||||
'email' => 'toto@gmail.com',
|
||||
'firstname' => 'string',
|
||||
'lastname' => 'string',
|
||||
|
|
@ -144,13 +144,13 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPropsAllSetNotOk()
|
||||
public function testPropsAllSetNotOk(): void
|
||||
{
|
||||
$this->expectException(ValidationException::class);
|
||||
$client = new Customer();
|
||||
|
||||
$propTypes = [
|
||||
'hashcode' => (string)Str::uuid(),
|
||||
'hashcode' => (string) Str::uuid(),
|
||||
'email' => 'toto@gmail.com',
|
||||
'firstname' => 'string',
|
||||
'lastname' => 'string',
|
||||
|
|
@ -172,16 +172,16 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Test set unkown prop fail
|
||||
* Test set unkown prop fail.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPropsAssignUnknown()
|
||||
public function testPropsAssignUnknown(): void
|
||||
{
|
||||
$this->expectException(AccessError::class);
|
||||
|
||||
$customer = new Customer([
|
||||
'hashcode' => (string)Str::uuid(),
|
||||
'hashcode' => (string) Str::uuid(),
|
||||
'email' => 'toto@gmail.com',
|
||||
'firstname' => 'string',
|
||||
'lastname' => 'string',
|
||||
|
|
@ -201,16 +201,16 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Test set prop fail wrong type
|
||||
* Test set prop fail wrong type.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPropsAssignWrongType()
|
||||
public function testPropsAssignWrongType(): void
|
||||
{
|
||||
$this->expectException(ValidationException::class);
|
||||
|
||||
$customer = new Customer([
|
||||
'hashcode' => (string)Str::uuid(),
|
||||
'hashcode' => (string) Str::uuid(),
|
||||
'email' => 'toto@gmail.com',
|
||||
'firstname' => 'string',
|
||||
'lastname' => 'string',
|
||||
|
|
@ -234,7 +234,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerGet()
|
||||
public function testCustomerGet(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$customer = $api->getCustomerOrNew(static::$info->hashcode);
|
||||
|
|
@ -259,7 +259,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerActivate()
|
||||
public function testCustomerActivate(): void
|
||||
{
|
||||
// Get non activated customer.
|
||||
/** @var \App\Models\Customer */
|
||||
|
|
@ -283,11 +283,11 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Test customer update
|
||||
* Test customer update.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerUpdateProps()
|
||||
public function testCustomerUpdateProps(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$customer = $api->getCustomerOrNew(static::$info->hashcode);
|
||||
|
|
@ -340,7 +340,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerToggleOptin()
|
||||
public function testCustomerToggleOptin(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$customer = $api->getCustomerOrNew(static::$info->hashcode);
|
||||
|
|
@ -359,11 +359,11 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* test customer store
|
||||
* Test customer store.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerStoreProps()
|
||||
public function testCustomerStoreProps(): void
|
||||
{
|
||||
$customer = new Customer();
|
||||
|
||||
|
|
@ -385,11 +385,11 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* test customer login
|
||||
* Test customer login.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerLogin()
|
||||
public function testCustomerLogin(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$customer = $api->getCustomerOrNew('toto.delarogerie@gmail.com');
|
||||
|
|
@ -404,7 +404,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerLoginUsingCustomerfromAnotherBrand()
|
||||
public function testCustomerLoginUsingCustomerfromAnotherBrand(): void
|
||||
{
|
||||
$this->expectException(ApiErrorException::class);
|
||||
$this->expectExceptionCode(ApiError::authFailed->value());
|
||||
|
|
@ -439,7 +439,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerStorePropsFails()
|
||||
public function testCustomerStorePropsFails(): void
|
||||
{
|
||||
$this->expectException(ValidationException::class);
|
||||
$customer = new Customer();
|
||||
|
|
@ -469,7 +469,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerDelete()
|
||||
public function testCustomerDelete(): void
|
||||
{
|
||||
$customer = new Customer();
|
||||
|
||||
|
|
@ -496,13 +496,13 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Make sute a customer exists and contains data
|
||||
* Make sute a customer exists and contains data.
|
||||
*
|
||||
* @param array $data
|
||||
* @param \App\Models\Brand $brand
|
||||
* @return void
|
||||
*/
|
||||
private function createNewCustomer(array $data, Brand $brand)
|
||||
private function createNewCustomer(array $data, Brand $brand): void
|
||||
{
|
||||
$customer = \App\Models\Customer::whereEmail($data['email'])
|
||||
->whereHas('brands', function ($q) use ($brand) {
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ use LDC\LDCCRM\Models\Question;
|
|||
class CrmClientQuestionTest extends CrmClientTester
|
||||
{
|
||||
/**
|
||||
* Get All Questions
|
||||
* Get all questions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetAllQuestions()
|
||||
public function testGetAllQuestions(): void
|
||||
{
|
||||
$questions = Question::all();
|
||||
$this->assertIsArray($questions, 'Should have returned an array');
|
||||
|
|
@ -38,11 +38,11 @@ class CrmClientQuestionTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testJsonSerialize()
|
||||
public function testJsonSerialize(): void
|
||||
{
|
||||
$questions = Question::all();
|
||||
$this->assertIsArray($questions);
|
||||
$this->assertTrue((bool)count($questions));
|
||||
$this->assertTrue((bool) count($questions));
|
||||
foreach ($questions as $question) {
|
||||
$jsonDecoded = \json_decode(\json_encode($question), true);
|
||||
$this->assertArrayHasKey('id', $jsonDecoded);
|
||||
|
|
@ -64,11 +64,11 @@ class CrmClientQuestionTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Get all question with user answers
|
||||
* Get all question with user answers.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetAllQuestionsWithCustomerAnswers()
|
||||
public function testGetAllQuestionsWithCustomerAnswers(): void
|
||||
{
|
||||
/** @var \App\Models\Question $answeredQuestion */
|
||||
$answeredQuestion = ModelsQuestion::whereHas('brand', function ($q) {
|
||||
|
|
@ -127,11 +127,11 @@ class CrmClientQuestionTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Get all unanswered questions
|
||||
* Get all unanswered questions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetAllCustomerUnAnsweredQuestions()
|
||||
public function testGetAllCustomerUnAnsweredQuestions(): void
|
||||
{
|
||||
/** @var \App\Models\Question $answeredQuestion */
|
||||
$answeredQuestion = ModelsQuestion::whereHas('brand', function ($q) {
|
||||
|
|
@ -179,7 +179,7 @@ class CrmClientQuestionTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSubmitCustomerAnswer()
|
||||
public function testSubmitCustomerAnswer(): void
|
||||
{
|
||||
/** @var \App\Models\Question $answeredQuestion */
|
||||
$answeredQuestion = ModelsQuestion::whereHas('brand', function ($q) {
|
||||
|
|
@ -224,11 +224,11 @@ class CrmClientQuestionTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Test unansweredBy
|
||||
* Test to get all customer unanswered questions should not contain first.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetAllCustomerUnansweredQuestionsShouldNotContainFirst()
|
||||
public function testGetAllCustomerUnansweredQuestionsShouldNotContainFirst(): void
|
||||
{
|
||||
$unWantedQuestion = Question::all()[0];
|
||||
|
||||
|
|
@ -242,11 +242,11 @@ class CrmClientQuestionTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* test allWithCustomerAnswers
|
||||
* Test all with customer answers.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetAllQuestionsWithCustomerAnswersShouldHaveAnswers()
|
||||
public function testGetAllQuestionsWithCustomerAnswersShouldHaveAnswers(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$customer = $api->getCustomerOrNew(static::$info->hashcode);
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ class CrmClientSingleOptinTest extends CrmClientTester
|
|||
private $email = 'singleoptin@hotmail.fr';
|
||||
|
||||
/**
|
||||
* Create and remove single optin test
|
||||
* Create and remove single optin test.
|
||||
* Calling multiple times single optin true should not fail.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCreateAndRemoveSingleOptin()
|
||||
public function testCreateAndRemoveSingleOptin(): void
|
||||
{
|
||||
// Set single optin and check.
|
||||
$this->assertTrue(SingleOptin::setStatus($this->email, true));
|
||||
|
|
@ -63,13 +63,12 @@ class CrmClientSingleOptinTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Remove single optin with hashcode test
|
||||
*
|
||||
* Remove single optin with hashcode test.
|
||||
* Calling multiple times single optin true should not fail.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testRemoveSingleOptinWithHashcode()
|
||||
public function testRemoveSingleOptinWithHashcode(): void
|
||||
{
|
||||
// Set single optin and check.
|
||||
$this->assertTrue(SingleOptin::setStatus($this->email, true));
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ use LDC\LDCCRM\Models\Stats;
|
|||
class CrmClientStatsTest extends CrmClientTester
|
||||
{
|
||||
/**
|
||||
* Get stats by brand
|
||||
* Get stats by brand.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testStatsByBrand()
|
||||
public function testStatsByBrand(): void
|
||||
{
|
||||
$start = Carbon::now()->subMonths(3);
|
||||
$end = Carbon::now();
|
||||
|
|
@ -49,7 +49,7 @@ class CrmClientStatsTest extends CrmClientTester
|
|||
* @return void
|
||||
* @throws \LDC\LDCCRM\Exceptions\ApiErrorException Because end date is before start date.
|
||||
*/
|
||||
public function testStatsByBrandShouldFailIfStartDateIsAfterEndDate()
|
||||
public function testStatsByBrandShouldFailIfStartDateIsAfterEndDate(): void
|
||||
{
|
||||
$this->expectException(ApiErrorException::class);
|
||||
$start = Carbon::now();
|
||||
|
|
@ -72,7 +72,7 @@ class CrmClientStatsTest extends CrmClientTester
|
|||
* @return void
|
||||
* @throws \LDC\LDCCRM\Exceptions\ApiErrorException Because interval is bigger thatn 3 months.
|
||||
*/
|
||||
public function testStatsByBrandShouldFailIfIntervalIsMoreThanThreeMonths()
|
||||
public function testStatsByBrandShouldFailIfIntervalIsMoreThanThreeMonths(): void
|
||||
{
|
||||
$this->expectException(ApiErrorException::class);
|
||||
$start = Carbon::now()->subMonths(3)->subDay();
|
||||
|
|
@ -94,7 +94,7 @@ class CrmClientStatsTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testStatsByQuestion()
|
||||
public function testStatsByQuestion(): void
|
||||
{
|
||||
/** @var \App\Models\Question $question */
|
||||
$question = Question::where('brand_id', self::$brand->id)->first();
|
||||
|
|
@ -128,7 +128,7 @@ class CrmClientStatsTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testStatsByQuestionShouldFailIfQuestionDoesNotBelongsToBrand()
|
||||
public function testStatsByQuestionShouldFailIfQuestionDoesNotBelongsToBrand(): void
|
||||
{
|
||||
$this->expectException(ApiErrorException::class);
|
||||
/** @var \App\Models\Question $question */
|
||||
|
|
@ -150,7 +150,7 @@ class CrmClientStatsTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testStatsByQuestionShouldFailIfStartDateIsAfterEndDate()
|
||||
public function testStatsByQuestionShouldFailIfStartDateIsAfterEndDate(): void
|
||||
{
|
||||
$this->expectException(ApiErrorException::class);
|
||||
/** @var \App\Models\Question $question */
|
||||
|
|
@ -172,7 +172,7 @@ class CrmClientStatsTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testStatsByQuestionShouldFailIfIntervalIsMoreThanThreeMonths()
|
||||
public function testStatsByQuestionShouldFailIfIntervalIsMoreThanThreeMonths(): void
|
||||
{
|
||||
$this->expectException(ApiErrorException::class);
|
||||
/** @var \App\Models\Question $question */
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ abstract class CrmClientTester extends BaseTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* Get customer
|
||||
* Get customer.
|
||||
*
|
||||
* @param boolean $status
|
||||
* @return array
|
||||
|
|
@ -78,7 +78,7 @@ abstract class CrmClientTester extends BaseTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* Parse routes.json and return routes list
|
||||
* Parse routes.json and return routes list.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -13,44 +13,44 @@ class HelperTest extends TestCase
|
|||
use CreatesApplication;
|
||||
|
||||
/**
|
||||
* Helper::getRoute test
|
||||
* Helper::getRoute test.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetRoute()
|
||||
public function testGetRoute(): void
|
||||
{
|
||||
$request = $this->makeRequest('apiV4.ping');
|
||||
$this->assertInstanceOf(\Illuminate\Routing\Route::class, Helper::getRoute($request));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper::getRoutePrefix test
|
||||
* Helper::getRoutePrefix test.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetRoutePrefix()
|
||||
public function testGetRoutePrefix(): void
|
||||
{
|
||||
$request = $this->makeRequest('apiV4.ping');
|
||||
$this->assertEquals($request->route()->getPrefix(), Helper::getRoutePrefix($request));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper::getRouteName test
|
||||
* Helper::getRouteName test.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetRouteName()
|
||||
public function testGetRouteName(): void
|
||||
{
|
||||
$request = $this->makeRequest('apiV4.ping');
|
||||
$this->assertEquals($request->route()->getName(), Helper::getRouteName($request));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper::isRequestForApiV4 test
|
||||
* Helper::isRequestForApiV4 test.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testIsRequestForApiV4()
|
||||
public function testIsRequestForApiV4(): void
|
||||
{
|
||||
$request = $this->makeRequest('apiV4.ping');
|
||||
$this->assertTrue(Helper::isRequestForApiV4($request));
|
||||
|
|
@ -62,7 +62,7 @@ class HelperTest extends TestCase
|
|||
* @param string $nameOrAction
|
||||
* @return \Illuminate\Http\Request
|
||||
*/
|
||||
private function makeRequest(string $nameOrAction): Request
|
||||
private function makeRequest(string $nameOrAction): \Illuminate\Http\Request
|
||||
{
|
||||
$route = Route::getRoutes()->getByName($nameOrAction) ?? Route::getRoutes()->getByAction($nameOrAction);
|
||||
$request = new Request([], [], [], [], [], ['REQUEST_URI' => $route->uri()]);
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ use Tests\TestCase;
|
|||
class UtilsTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Test Utils validator
|
||||
* Test utils validator.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testUtilsValidator()
|
||||
public function testUtilsValidator(): void
|
||||
{
|
||||
$this->expectNotToPerformAssertions();
|
||||
Utils::makeValidator([
|
||||
|
|
@ -36,7 +36,7 @@ class UtilsTest extends TestCase
|
|||
'bool' => true
|
||||
], ['bool' => 'bool'])();
|
||||
Utils::makeValidator([
|
||||
'uuid' => (string)Str::uuid()
|
||||
'uuid' => (string) Str::uuid()
|
||||
], ['uuid' => 'uuid|string'])();
|
||||
Utils::makeValidator([
|
||||
'date' => date('Y-m-d')
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class RunMultipleRequestsTest extends TestCase
|
|||
public function testSpamSingleOptin(): void
|
||||
{
|
||||
for ($i = 35; $i >= 0; $i--) {
|
||||
$this->assertTrue(SingleOptin::setStatus('singleoptinteststress@gmail.com', (bool)rand(0, 1)));
|
||||
$this->assertTrue(SingleOptin::setStatus('singleoptinteststress@gmail.com', (bool) rand(0, 1)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue