Compare commits
1 commit
master
...
stressTest
| Author | SHA1 | Date | |
|---|---|---|---|
| b530ca10bb |
13 changed files with 399 additions and 215 deletions
|
|
@ -14,6 +14,7 @@ use Illuminate\Database\Eloquent\ModelNotFoundException;
|
|||
use Illuminate\Http\Exceptions\ThrottleRequestsException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Kwaadpepper\ExceptionHandler\Exceptions\ExceptionHandler;
|
||||
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
|
||||
|
|
@ -65,6 +66,7 @@ class Handler extends ExceptionHandler
|
|||
public function render($request, Throwable $e)
|
||||
{
|
||||
if (Helper::isRequestForApiV2($request) and $request->isJson()) {
|
||||
Log::debug($e->getMessage());
|
||||
switch (get_class($e)) {
|
||||
case AuthenticationException::class:
|
||||
/** @var AuthenticationException $e */
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use App\Models\Service;
|
|||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ApiController extends Controller
|
||||
{
|
||||
|
|
@ -20,17 +21,22 @@ class ApiController extends Controller
|
|||
|
||||
public function authenticate(Request $request)
|
||||
{
|
||||
$bearerToken = null;
|
||||
try {
|
||||
$bearerToken = Helper::getBearerTokenFromRequest($request);
|
||||
if (!$bearerToken) {
|
||||
Log::debug('authenticate: missing bearerToken');
|
||||
throw new ApiErrorException(ApiError::missingParameter());
|
||||
}
|
||||
/** @var \App\Models\Service */
|
||||
$service = Service::getFromBearerToken($bearerToken);
|
||||
} catch (ModelNotFoundException $e) {
|
||||
$bearerToken = Hash::make($bearerToken);
|
||||
Log::debug("authenticate: service not found $bearerToken");
|
||||
throw new ApiErrorException(ApiError::apiAuthFailed());
|
||||
}
|
||||
if (!Hash::check($request->bearer_pwd, $service->bearer_pwd)) {
|
||||
Log::debug('authenticate: wrong credentials');
|
||||
throw new ApiErrorException(ApiError::apiAuthFailed());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,13 +11,11 @@ use Illuminate\Support\Str;
|
|||
use Kwaadpepper\CrudPolicies\Enums\CrudAction;
|
||||
use Kwaadpepper\CrudPolicies\Enums\CrudType;
|
||||
use Kwaadpepper\CrudPolicies\Traits\IsCrudModel;
|
||||
use Rennokki\QueryCache\Traits\QueryCacheable;
|
||||
|
||||
class Service extends Model
|
||||
{
|
||||
use IsCrudModel;
|
||||
use HasFactory;
|
||||
use QueryCacheable;
|
||||
|
||||
protected $crudLabelColumn = 'name';
|
||||
|
||||
|
|
@ -103,18 +101,6 @@ class Service extends Model
|
|||
$service->api_token = Hash::make($service->api_token);
|
||||
}
|
||||
});
|
||||
static::created(function () {
|
||||
// flush Eloquent cache
|
||||
self::flushQueryCache();
|
||||
});
|
||||
static::updated(function () {
|
||||
// flush Eloquent cache
|
||||
self::flushQueryCache();
|
||||
});
|
||||
static::deleted(function () {
|
||||
// flush Eloquent cache
|
||||
self::flushQueryCache();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit f1398e1e1405ea1eba73aa3885e9f96de872954c
|
||||
Subproject commit 796bc1a8142c191073b9cc091d5a569c238f5f3e
|
||||
213
composer.json
213
composer.json
|
|
@ -1,110 +1,117 @@
|
|||
{
|
||||
"name": "ldc/ldccrmv2client",
|
||||
"type": "project",
|
||||
"version": "2.3.0",
|
||||
"description": "LDC CRM V2",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Romain Bonhomme",
|
||||
"email": "romain.bonhomme@ldc.fr"
|
||||
},
|
||||
{
|
||||
"name": "Vincent Bridier",
|
||||
"email": "vicent.bridier@ldc.fr",
|
||||
"homepage": "https://bridier.me"
|
||||
},
|
||||
{
|
||||
"name": "Jérémy Munsch",
|
||||
"email": "jeremy.munsch@ldc.fr",
|
||||
"homepage": "https://jeremydev.ovh"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7",
|
||||
"ext-curl": "*",
|
||||
"ext-dom": "*",
|
||||
"ext-json": "*",
|
||||
"ext-memcached": "^3.1",
|
||||
"arondeparon/laravel-request-sanitizer": "^3.1",
|
||||
"axlon/laravel-postal-code-validation": "^3.2",
|
||||
"cache/memcached-adapter": "^1.1",
|
||||
"doctrine/dbal": "^3.0",
|
||||
"fideloper/proxy": "^4.4",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"kwaadpepper/crud-policies": "^0.1.22",
|
||||
"kwaadpepper/enum": "^2.1",
|
||||
"kwaadpepper/exception-handler": "^0.0.5",
|
||||
"laravel-lang/lang": "~7.0",
|
||||
"laravel/framework": "^8.39",
|
||||
"laravel/tinker": "^2.5",
|
||||
"league/csv": "^9.7",
|
||||
"propaganistas/laravel-phone": "^4.3",
|
||||
"rennokki/laravel-eloquent-query-cache": "^3.0",
|
||||
"spatie/laravel-mix-preload": "^1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"facade/ignition": "^2.5",
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"mockery/mockery": "^1.4.2",
|
||||
"nunomaduro/collision": "^5.0",
|
||||
"phpunit/phpunit": "^9.3.3",
|
||||
"respect/validation": "^2.2",
|
||||
"slevomat/coding-standard": "^7.0",
|
||||
"squizlabs/php_codesniffer": "^3.5",
|
||||
"symfony/process": "^5.3"
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"platform": {
|
||||
"php": "7.3.26"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\migrations\\": "database/migrations/",
|
||||
"Database\\Seeders\\": "database/seeders/",
|
||||
"LDC\\LDCCRM\\" : "clients/V2/src/",
|
||||
"LDCCRM\\" : "clients/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"scripts": {
|
||||
"name": "ldc/ldccrmv2client",
|
||||
"type": "project",
|
||||
"version": "2.3.0",
|
||||
"description": "LDC CRM V2",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Romain Bonhomme",
|
||||
"email": "romain.bonhomme@ldc.fr"
|
||||
},
|
||||
{
|
||||
"name": "Vincent Bridier",
|
||||
"email": "vicent.bridier@ldc.fr",
|
||||
"homepage": "https://bridier.me"
|
||||
},
|
||||
{
|
||||
"name": "Jérémy Munsch",
|
||||
"email": "jeremy.munsch@ldc.fr",
|
||||
"homepage": "https://jeremydev.ovh"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7",
|
||||
"ext-curl": "*",
|
||||
"ext-dom": "*",
|
||||
"ext-json": "*",
|
||||
"ext-memcached": "^3.1",
|
||||
"arondeparon/laravel-request-sanitizer": "^3.1",
|
||||
"axlon/laravel-postal-code-validation": "^3.2",
|
||||
"cache/memcached-adapter": "^1.1",
|
||||
"doctrine/dbal": "^3.0",
|
||||
"fideloper/proxy": "^4.4",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"kwaadpepper/crud-policies": "^0.1.22",
|
||||
"kwaadpepper/enum": "^2.1",
|
||||
"kwaadpepper/exception-handler": "^0.0.5",
|
||||
"laravel-lang/lang": "~7.0",
|
||||
"laravel/framework": "^8.39",
|
||||
"laravel/tinker": "^2.5",
|
||||
"league/csv": "^9.7",
|
||||
"propaganistas/laravel-phone": "^4.3",
|
||||
"rennokki/laravel-eloquent-query-cache": "^3.0",
|
||||
"spatie/laravel-mix-preload": "^1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"brianium/paratest": "^6.4",
|
||||
"facade/ignition": "^2.5",
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"mockery/mockery": "^1.4.2",
|
||||
"nunomaduro/collision": "^5.0",
|
||||
"phpunit/phpunit": "^9.3.3",
|
||||
"respect/validation": "^2.2",
|
||||
"slevomat/coding-standard": "^7.0",
|
||||
"squizlabs/php_codesniffer": "^3.5",
|
||||
"symfony/process": "^5.3"
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"platform": {
|
||||
"php": "7.3.26"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\migrations\\": "database/migrations/",
|
||||
"Database\\Seeders\\": "database/seeders/",
|
||||
"LDC\\LDCCRM\\": "clients/V2/src/",
|
||||
"LDCCRM\\": "clients/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"scripts": {
|
||||
"stresstest": [
|
||||
"echo 'check memcached is running';netcat -z 127.0.0.1 11211",
|
||||
"@configclear",
|
||||
"./stresstest.sh"
|
||||
],
|
||||
"test": [
|
||||
"echo 'check memcached is running';netcat -z 127.0.0.1 11211",
|
||||
"@configclear",
|
||||
"./test.sh"
|
||||
],
|
||||
"configclear": "@php artisan config:clear",
|
||||
"runtestmigration": "@php artisan migrate:fresh --env=testing --seed",
|
||||
"runtest": "@php artisan test",
|
||||
"runserve": "@php artisan serve --host=127.0.0.1 --port=8888 --env=testing&",
|
||||
"killserve": "kill $(ps -f | grep '[1]27.0.0.1:8888' | awk '{print $2}')",
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi"
|
||||
]
|
||||
}
|
||||
"configclear": "@php artisan config:clear",
|
||||
"runtestmigration": "@php artisan migrate:fresh --env=testing --seed",
|
||||
"runstresstest": "@php artisan test --testsuite='StressTest'",
|
||||
"runtest": "@php artisan test --testsuite='FullCRM'",
|
||||
"runserve": "@php artisan serve --host=127.0.0.1 --port=8888 --env=testing&",
|
||||
"killserve": "kill $(ps -f | grep '[1]27.0.0.1:8888' | awk '{print $2}')",
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
286
composer.lock
generated
286
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "d5902dd3c7b94b0d612840e1117525c8",
|
||||
"content-hash": "fc3d0fdc902105f6e612add9f0bea7b3",
|
||||
"packages": [
|
||||
{
|
||||
"name": "arondeparon/laravel-request-sanitizer",
|
||||
|
|
@ -3115,16 +3115,16 @@
|
|||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
"version": "v4.13.1",
|
||||
"version": "v4.13.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/PHP-Parser.git",
|
||||
"reference": "63a79e8daa781cac14e5195e63ed8ae231dd10fd"
|
||||
"reference": "210577fe3cf7badcc5814d99455df46564f3c077"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/63a79e8daa781cac14e5195e63ed8ae231dd10fd",
|
||||
"reference": "63a79e8daa781cac14e5195e63ed8ae231dd10fd",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077",
|
||||
"reference": "210577fe3cf7badcc5814d99455df46564f3c077",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -3165,9 +3165,9 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v4.13.1"
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2"
|
||||
},
|
||||
"time": "2021-11-03T20:52:16+00:00"
|
||||
"time": "2021-11-30T19:35:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "opis/closure",
|
||||
|
|
@ -4284,26 +4284,26 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v5.3.10",
|
||||
"version": "v5.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3"
|
||||
"reference": "ec3661faca1d110d6c307e124b44f99ac54179e3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3",
|
||||
"reference": "d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/ec3661faca1d110d6c307e124b44f99ac54179e3",
|
||||
"reference": "ec3661faca1d110d6c307e124b44f99ac54179e3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.5",
|
||||
"symfony/deprecation-contracts": "^2.1",
|
||||
"symfony/deprecation-contracts": "^2.1|^3",
|
||||
"symfony/polyfill-mbstring": "~1.0",
|
||||
"symfony/polyfill-php73": "^1.8",
|
||||
"symfony/polyfill-php80": "^1.16",
|
||||
"symfony/service-contracts": "^1.1|^2",
|
||||
"symfony/string": "^5.1"
|
||||
"symfony/service-contracts": "^1.1|^2|^3",
|
||||
"symfony/string": "^5.1|^6.0"
|
||||
},
|
||||
"conflict": {
|
||||
"psr/log": ">=3",
|
||||
|
|
@ -4318,12 +4318,12 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"psr/log": "^1|^2",
|
||||
"symfony/config": "^4.4|^5.0",
|
||||
"symfony/dependency-injection": "^4.4|^5.0",
|
||||
"symfony/event-dispatcher": "^4.4|^5.0",
|
||||
"symfony/lock": "^4.4|^5.0",
|
||||
"symfony/process": "^4.4|^5.0",
|
||||
"symfony/var-dumper": "^4.4|^5.0"
|
||||
"symfony/config": "^4.4|^5.0|^6.0",
|
||||
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
|
||||
"symfony/event-dispatcher": "^4.4|^5.0|^6.0",
|
||||
"symfony/lock": "^4.4|^5.0|^6.0",
|
||||
"symfony/process": "^4.4|^5.0|^6.0",
|
||||
"symfony/var-dumper": "^4.4|^5.0|^6.0"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "For using the console logger",
|
||||
|
|
@ -4363,7 +4363,7 @@
|
|||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/console/tree/v5.3.10"
|
||||
"source": "https://github.com/symfony/console/tree/v5.4.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -4379,7 +4379,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-10-26T09:30:15+00:00"
|
||||
"time": "2021-11-29T15:30:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
|
|
@ -4449,16 +4449,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/deprecation-contracts",
|
||||
"version": "v2.4.0",
|
||||
"version": "v2.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/deprecation-contracts.git",
|
||||
"reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627"
|
||||
"reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627",
|
||||
"reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627",
|
||||
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8",
|
||||
"reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -4467,7 +4467,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "2.4-dev"
|
||||
"dev-main": "2.5-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
|
|
@ -4496,7 +4496,7 @@
|
|||
"description": "A generic function and convention to trigger deprecation notices",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0"
|
||||
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -4512,7 +4512,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-03-23T23:28:01+00:00"
|
||||
"time": "2021-07-12T14:48:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/error-handler",
|
||||
|
|
@ -4669,16 +4669,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher-contracts",
|
||||
"version": "v2.4.0",
|
||||
"version": "v2.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/event-dispatcher-contracts.git",
|
||||
"reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11"
|
||||
"reference": "66bea3b09be61613cd3b4043a65a8ec48cfa6d2a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/69fee1ad2332a7cbab3aca13591953da9cdb7a11",
|
||||
"reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/66bea3b09be61613cd3b4043a65a8ec48cfa6d2a",
|
||||
"reference": "66bea3b09be61613cd3b4043a65a8ec48cfa6d2a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -4691,7 +4691,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "2.4-dev"
|
||||
"dev-main": "2.5-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
|
|
@ -4728,7 +4728,7 @@
|
|||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.4.0"
|
||||
"source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -4744,7 +4744,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-03-23T23:28:01+00:00"
|
||||
"time": "2021-07-12T14:48:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
|
|
@ -4810,16 +4810,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/http-client-contracts",
|
||||
"version": "v2.4.0",
|
||||
"version": "v2.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-client-contracts.git",
|
||||
"reference": "7e82f6084d7cae521a75ef2cb5c9457bbda785f4"
|
||||
"reference": "ec82e57b5b714dbb69300d348bd840b345e24166"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/7e82f6084d7cae521a75ef2cb5c9457bbda785f4",
|
||||
"reference": "7e82f6084d7cae521a75ef2cb5c9457bbda785f4",
|
||||
"url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/ec82e57b5b714dbb69300d348bd840b345e24166",
|
||||
"reference": "ec82e57b5b714dbb69300d348bd840b345e24166",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -4831,7 +4831,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "2.4-dev"
|
||||
"dev-main": "2.5-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
|
|
@ -4868,7 +4868,7 @@
|
|||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/http-client-contracts/tree/v2.4.0"
|
||||
"source": "https://github.com/symfony/http-client-contracts/tree/v2.5.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -4884,7 +4884,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-04-11T23:07:08+00:00"
|
||||
"time": "2021-11-03T09:24:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
|
|
@ -5964,16 +5964,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v5.3.7",
|
||||
"version": "v5.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "38f26c7d6ed535217ea393e05634cb0b244a1967"
|
||||
"reference": "5be20b3830f726e019162b26223110c8f47cf274"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/38f26c7d6ed535217ea393e05634cb0b244a1967",
|
||||
"reference": "38f26c7d6ed535217ea393e05634cb0b244a1967",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/5be20b3830f726e019162b26223110c8f47cf274",
|
||||
"reference": "5be20b3830f726e019162b26223110c8f47cf274",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -6006,7 +6006,7 @@
|
|||
"description": "Executes commands in sub-processes",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/process/tree/v5.3.7"
|
||||
"source": "https://github.com/symfony/process/tree/v5.4.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -6022,7 +6022,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-08-04T21:20:46+00:00"
|
||||
"time": "2021-11-28T15:25:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/routing",
|
||||
|
|
@ -6116,21 +6116,25 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/service-contracts",
|
||||
"version": "v2.4.0",
|
||||
"version": "v2.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/service-contracts.git",
|
||||
"reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb"
|
||||
"reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb",
|
||||
"reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb",
|
||||
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc",
|
||||
"reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.5",
|
||||
"psr/container": "^1.1"
|
||||
"psr/container": "^1.1",
|
||||
"symfony/deprecation-contracts": "^2.1"
|
||||
},
|
||||
"conflict": {
|
||||
"ext-psr": "<1.1|>=2"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/service-implementation": ""
|
||||
|
|
@ -6138,7 +6142,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "2.4-dev"
|
||||
"dev-main": "2.5-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
|
|
@ -6175,7 +6179,7 @@
|
|||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/service-contracts/tree/v2.4.0"
|
||||
"source": "https://github.com/symfony/service-contracts/tree/v2.5.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -6191,20 +6195,20 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-04-01T10:43:52+00:00"
|
||||
"time": "2021-11-04T16:48:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/string",
|
||||
"version": "v5.3.10",
|
||||
"version": "v5.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/string.git",
|
||||
"reference": "d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c"
|
||||
"reference": "9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c",
|
||||
"reference": "d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d",
|
||||
"reference": "9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -6215,11 +6219,14 @@
|
|||
"symfony/polyfill-mbstring": "~1.0",
|
||||
"symfony/polyfill-php80": "~1.15"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/translation-contracts": ">=3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/error-handler": "^4.4|^5.0",
|
||||
"symfony/http-client": "^4.4|^5.0",
|
||||
"symfony/error-handler": "^4.4|^5.0|^6.0",
|
||||
"symfony/http-client": "^4.4|^5.0|^6.0",
|
||||
"symfony/translation-contracts": "^1.1|^2",
|
||||
"symfony/var-exporter": "^4.4|^5.0"
|
||||
"symfony/var-exporter": "^4.4|^5.0|^6.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
|
|
@ -6258,7 +6265,7 @@
|
|||
"utf8"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/string/tree/v5.3.10"
|
||||
"source": "https://github.com/symfony/string/tree/v5.4.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -6274,7 +6281,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-10-27T18:21:46+00:00"
|
||||
"time": "2021-11-24T10:02:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
|
|
@ -6373,16 +6380,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/translation-contracts",
|
||||
"version": "v2.4.0",
|
||||
"version": "v2.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/translation-contracts.git",
|
||||
"reference": "95c812666f3e91db75385749fe219c5e494c7f95"
|
||||
"reference": "d28150f0f44ce854e942b671fc2620a98aae1b1e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/translation-contracts/zipball/95c812666f3e91db75385749fe219c5e494c7f95",
|
||||
"reference": "95c812666f3e91db75385749fe219c5e494c7f95",
|
||||
"url": "https://api.github.com/repos/symfony/translation-contracts/zipball/d28150f0f44ce854e942b671fc2620a98aae1b1e",
|
||||
"reference": "d28150f0f44ce854e942b671fc2620a98aae1b1e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -6394,7 +6401,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "2.4-dev"
|
||||
"dev-main": "2.5-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
|
|
@ -6431,7 +6438,7 @@
|
|||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/translation-contracts/tree/v2.4.0"
|
||||
"source": "https://github.com/symfony/translation-contracts/tree/v2.5.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -6447,7 +6454,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-03-23T23:28:01+00:00"
|
||||
"time": "2021-08-17T14:20:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-dumper",
|
||||
|
|
@ -6802,6 +6809,101 @@
|
|||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "brianium/paratest",
|
||||
"version": "v6.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/paratestphp/paratest.git",
|
||||
"reference": "c32a5c4fc2ff339202437d25d19a5f496f880d61"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/paratestphp/paratest/zipball/c32a5c4fc2ff339202437d25d19a5f496f880d61",
|
||||
"reference": "c32a5c4fc2ff339202437d25d19a5f496f880d61",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-dom": "*",
|
||||
"ext-pcre": "*",
|
||||
"ext-reflection": "*",
|
||||
"ext-simplexml": "*",
|
||||
"php": "^7.3 || ^8.0",
|
||||
"phpunit/php-code-coverage": "^9.2.9",
|
||||
"phpunit/php-file-iterator": "^3.0.5",
|
||||
"phpunit/php-timer": "^5.0.3",
|
||||
"phpunit/phpunit": "^9.5.10",
|
||||
"sebastian/environment": "^5.1.3",
|
||||
"symfony/console": "^5.4.0 || ^6.0.0",
|
||||
"symfony/process": "^5.4.0 || ^6.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^9.0.0",
|
||||
"ekino/phpstan-banned-code": "^0.5.0",
|
||||
"ergebnis/phpstan-rules": "^0.15.3",
|
||||
"ext-posix": "*",
|
||||
"infection/infection": "^0.25.3",
|
||||
"malukenho/mcbumpface": "^1.1.5",
|
||||
"phpstan/phpstan": "^0.12.99",
|
||||
"phpstan/phpstan-deprecation-rules": "^0.12.6",
|
||||
"phpstan/phpstan-phpunit": "^0.12.22",
|
||||
"phpstan/phpstan-strict-rules": "^0.12.11",
|
||||
"squizlabs/php_codesniffer": "^3.6.1",
|
||||
"symfony/filesystem": "^v5.4.0",
|
||||
"thecodingmachine/phpstan-strict-rules": "^v0.12.2",
|
||||
"vimeo/psalm": "^4.13.1"
|
||||
},
|
||||
"bin": [
|
||||
"bin/paratest"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"ParaTest\\": [
|
||||
"src/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Brian Scaturro",
|
||||
"email": "scaturrob@gmail.com",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Filippo Tessarotto",
|
||||
"email": "zoeslam@gmail.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Parallel testing for PHP",
|
||||
"homepage": "https://github.com/paratestphp/paratest",
|
||||
"keywords": [
|
||||
"concurrent",
|
||||
"parallel",
|
||||
"phpunit",
|
||||
"testing"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/paratestphp/paratest/issues",
|
||||
"source": "https://github.com/paratestphp/paratest/tree/v6.4.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sponsors/Slamdunk",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://paypal.me/filippotessarotto",
|
||||
"type": "paypal"
|
||||
}
|
||||
],
|
||||
"time": "2021-12-02T09:12:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "dealerdirect/phpcodesniffer-composer-installer",
|
||||
"version": "v0.7.1",
|
||||
|
|
@ -7811,16 +7913,16 @@
|
|||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
"version": "9.2.8",
|
||||
"version": "9.2.10",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
||||
"reference": "cf04e88a2e3c56fc1a65488afd493325b4c1bc3e"
|
||||
"reference": "d5850aaf931743067f4bfc1ae4cbd06468400687"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/cf04e88a2e3c56fc1a65488afd493325b4c1bc3e",
|
||||
"reference": "cf04e88a2e3c56fc1a65488afd493325b4c1bc3e",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d5850aaf931743067f4bfc1ae4cbd06468400687",
|
||||
"reference": "d5850aaf931743067f4bfc1ae4cbd06468400687",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -7876,7 +7978,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.8"
|
||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.10"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -7884,20 +7986,20 @@
|
|||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2021-10-30T08:01:38+00:00"
|
||||
"time": "2021-12-05T09:12:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-file-iterator",
|
||||
"version": "3.0.5",
|
||||
"version": "3.0.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
||||
"reference": "aa4be8575f26070b100fccb67faabb28f21f66f8"
|
||||
"reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8",
|
||||
"reference": "aa4be8575f26070b100fccb67faabb28f21f66f8",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf",
|
||||
"reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -7936,7 +8038,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
|
||||
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5"
|
||||
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -7944,7 +8046,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-09-28T05:57:25+00:00"
|
||||
"time": "2021-12-02T12:48:52+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-invoker",
|
||||
|
|
@ -8783,16 +8885,16 @@
|
|||
},
|
||||
{
|
||||
"name": "sebastian/exporter",
|
||||
"version": "4.0.3",
|
||||
"version": "4.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/exporter.git",
|
||||
"reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65"
|
||||
"reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65",
|
||||
"reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9",
|
||||
"reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -8841,14 +8943,14 @@
|
|||
}
|
||||
],
|
||||
"description": "Provides the functionality to export PHP variables for visualization",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/exporter",
|
||||
"homepage": "https://www.github.com/sebastianbergmann/exporter",
|
||||
"keywords": [
|
||||
"export",
|
||||
"exporter"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/exporter/issues",
|
||||
"source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3"
|
||||
"source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -8856,7 +8958,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-09-28T05:24:23+00:00"
|
||||
"time": "2021-11-11T14:18:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/global-state",
|
||||
|
|
|
|||
11
phpunit.xml
11
phpunit.xml
|
|
@ -5,6 +5,13 @@
|
|||
colors="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="FullCRM">
|
||||
<directory suffix="Test.php">./tests/Unit</directory>
|
||||
<directory suffix="Test.php">./tests/Feature/ApiV2</directory>
|
||||
</testsuite>
|
||||
<testsuite name="StressTest">
|
||||
<directory suffix="Test.php">./tests/StressTest</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Unit">
|
||||
<directory suffix="Test.php">./tests/Unit</directory>
|
||||
</testsuite>
|
||||
|
|
@ -19,7 +26,9 @@
|
|||
</coverage>
|
||||
<php>
|
||||
<server name="APP_ENV" value="testing"/>
|
||||
<server name="APP_URL" value="http://127.0.0.1:8888"/>
|
||||
<server name="APP_URL" value="http://crm.local"/>
|
||||
<env name="APP_URL" value="http://crm.local"/>
|
||||
|
||||
<server name="BCRYPT_ROUNDS" value="4"/>
|
||||
<server name="CACHE_DRIVER" value="array"/>
|
||||
<server name="MAIL_MAILER" value="array"/>
|
||||
|
|
|
|||
9
stresstest.sh
Executable file
9
stresstest.sh
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
#composer runtestmigration >/dev/null
|
||||
#composer runserve
|
||||
composer runstresstest &
|
||||
composer runstresstest &
|
||||
composer runstresstest &
|
||||
composer runstresstest &
|
||||
composer runstresstest &
|
||||
#composer killserve
|
||||
5
test.sh
5
test.sh
|
|
@ -1,2 +1,5 @@
|
|||
#!/bin/sh
|
||||
composer runtestmigration > /dev/null; composer runserve; composer runtest; composer killserve;
|
||||
composer runtestmigration >/dev/null
|
||||
composer runserve
|
||||
composer runtest
|
||||
composer killserve
|
||||
|
|
|
|||
20
tests/StressTest/CustomerStressTest.php
Normal file
20
tests/StressTest/CustomerStressTest.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use LDC\LDCCRM\CrmApiV2;
|
||||
use LDC\LDCCRM\Models\Customer;
|
||||
|
||||
class CustomerStressTest extends CrmClientTester
|
||||
{
|
||||
public function testCustomerGet()
|
||||
{
|
||||
$api = new CrmApiV2();
|
||||
$customer = $api->getCustomerOrNew(static::$info->hashcode);
|
||||
|
||||
for ($i = 0; $i < 15; $i++) {
|
||||
$cst = Customer::findWithEmail($customer->email);
|
||||
$this->assertIsObject($cst, 'Should have retrieved customer');
|
||||
}
|
||||
}
|
||||
}
|
||||
20
tests/StressTest/LoginStressTest.php
Normal file
20
tests/StressTest/LoginStressTest.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use LDC\LDCCRM\CrmApiV2;
|
||||
use LDC\LDCCRM\Models\Customer;
|
||||
|
||||
class LoginStressTest extends CrmClientTester
|
||||
{
|
||||
public function testCustomerLogin()
|
||||
{
|
||||
$api = new CrmApiV2();
|
||||
$customer = $api->getCustomerOrNew(static::$info->hashcode);
|
||||
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
$loginOK = Customer::login($customer->email, 'testPassword');
|
||||
$this->assertTrue($loginOK, 'Should have loggedin');
|
||||
}
|
||||
}
|
||||
}
|
||||
18
tests/StressTest/SingleOptinStressTest.php
Normal file
18
tests/StressTest/SingleOptinStressTest.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use LDC\LDCCRM\Models\SingleOptin;
|
||||
|
||||
class SingleOptinStressTest extends CrmClientTester
|
||||
{
|
||||
public function testCustomerGet()
|
||||
{
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
$optinStatusWasSet = SingleOptin::setStatus('test@gmail.com', true);
|
||||
$this->assertTrue($optinStatusWasSet, 'Should have updated singleoptin');
|
||||
$optinStatusWasSet = SingleOptin::setStatus('test@gmail.com', false);
|
||||
$this->assertTrue($optinStatusWasSet, 'Should have updated singleoptin');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -39,18 +39,20 @@ abstract class CrmClientTester extends TestCase
|
|||
}
|
||||
config(['crm.token' => self::$service->bearer_token]);
|
||||
config(['crm.password' => self::$service->bearer_pwd]);
|
||||
config(['crm.endpoint' => 'http://127.0.0.1:8888']);
|
||||
config(['crm.endpoint' => env('APP_URL')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected static function getCustomer(bool $status = true)
|
||||
protected static function getCustomer(bool $status = true, bool $noRandom = false)
|
||||
{
|
||||
/** @var \App\Models\Costumer $customer */
|
||||
$customer = Customer::whereHas('logins', function ($q) use ($status) {
|
||||
$q->where('status', $status);
|
||||
})->inRandomOrder()->firstOrFail();
|
||||
});
|
||||
$customer = $noRandom ? $customer->firstOrFail() :
|
||||
$customer->inRandomOrder()->firstOrFail();
|
||||
/** @var \App\Models\Brand $brand */
|
||||
$login = $customer->logins()->where('status', $status)->firstOrFail();
|
||||
/** @var \App\Models\CustomerLogin $login */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue