Merge branch 'develop' into trunk

This commit is contained in:
Vincent BRIDIER 2024-09-09 15:29:26 +02:00
commit 9c6842bc56
No known key found for this signature in database
GPG key ID: 8571BFA20420D512
10 changed files with 1505 additions and 1418 deletions

View file

@ -1,52 +1,3 @@
# Comment lancer les tests unitaires ?
### Attention, si vous utilisez juste un .env à la place d'un .env.testing votre base de donnée de developpement sera effacée à chaque lancement des tests unitaires
Etapes :
- cp .env.testing.example .env.testing (spécial tests unitaires)
- php artisan key:generate
- parameter les BDD dans le .env.testing
- php artisan config:cache
- git submodule init
- git submodule update (récupérer le client)
- composer install
- service start mysql (votre base de donnée accessible sur 127.0.0.1:3306)
- chmod u+x ./test.sh
- php artisan optimize
- composer run test
Config Supervisor 2 Fichiers :
`ldccrm-worker.conf`
**Pour les jobs en général**
[program:ldccrm-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /u1/DATA01/webldc/Apps/ldccrm/ldccrm-12-2020/srcs/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
startasgroup=true
killasgroup=true
user=www-data
umask=077
numprocs=8
redirect_stderr=true
stdout_logfile=/u1/DATA01/webldc/Apps/ldccrm/ldccrm-12-2020/srcs/storage/logs/worker.log
stopwaitsecs=3600
`ldccrm-stats-worker.conf`
**Pour les jobs de stats uniquement**
[program:ldccrm-stats-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /u1/DATA01/webldc/Apps/ldccrm/ldccrm-12-2020/srcs/artisan queue:work --queue=stats --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
startasgroup=true
killasgroup=true
user=www-data
umask=077
numprocs=1
redirect_stderr=true
stdout_logfile=/u1/DATA01/webldc/Apps/ldccrm/ldccrm-12-2020/srcs/storage/logs/worker.log
stopwaitsecs=3600
[Suivre le wiki dédié au tests unitaires](https://lab.s-web.fr/ldc-web/projets/crm/-/wikis/Tests-unitaires)

View file

@ -568,7 +568,8 @@ enum Country: int
Country::saintMartinFrenchPart,
Country::wallisAndFutuna,
Country::frenchPolynesia,
Country::newCaledonia
Country::newCaledonia,
Country::netherlands,
];
}
@ -580,20 +581,21 @@ enum Country: int
protected static function isoCodes(): array
{
return [
'france' => 'FR',
'belgium' => 'BE',
'luxembourg' => 'LU',
'guadeloupe' => 'GP',
'martinique' => 'MQ',
'frenchGuiana' => 'GF',
'reunion' => 'RE',
'france' => 'FR',
'belgium' => 'BE',
'luxembourg' => 'LU',
'guadeloupe' => 'GP',
'martinique' => 'MQ',
'frenchGuiana' => 'GF',
'reunion' => 'RE',
'saintPierreAndMiquelon' => 'PM',
'mayotte' => 'YT',
'saintBarthelemy' => 'BL',
'saintMartinFrenchPart' => 'MF',
'wallisAndFutuna' => 'WF',
'frenchPolynesia' => 'PF',
'newCaledonia' => 'NC',
'mayotte' => 'YT',
'saintBarthelemy' => 'BL',
'saintMartinFrenchPart' => 'MF',
'wallisAndFutuna' => 'WF',
'frenchPolynesia' => 'PF',
'newCaledonia' => 'NC',
'netherlands' => 'NL',
];
}

View file

@ -28,7 +28,7 @@ class StoreCustomerAnswers extends BaseApiRequest
'question' => [
'required',
"exists:$questionTableName,id",
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) use ($question, $brandId) {
if ($question->brand->id !== $brandId) {
$fail("$attribute does not belong to brand $brandId");

View file

@ -25,7 +25,7 @@ class StoreCustomerAnswers extends BaseApiRequest
'question' => [
'required',
"exists:$questionTableName,id",
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) use ($question, $brandId) {
if ($question->brand->id !== $brandId) {
$fail("$attribute does not belong to brand $brandId");

View file

@ -29,7 +29,7 @@ class CustomerExport extends FormRequest
'export_type' => [
'required',
'numeric',
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) {
if (!\in_array($value, CustomerExportType::toValues())) {
$fail(trans('Le type d\'export invalide'));

View file

@ -107,7 +107,7 @@ class ActivityLog extends Model
$activity->model_id
)->first();
if ($targetModel != null) {
// phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
$targetModelTypes = collect($targetModel->toArray())
->map(function ($field, $fieldIndex) use ($targetModel) {
return Schema::getColumnType($targetModel->getTable(), $fieldIndex);

View file

@ -110,8 +110,7 @@ class RouteServiceProvider extends ServiceProvider
->by(optional($request->user())->id ?: app('clientIp'));
// @codeCoverageIgnoreEnd
});
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
RateLimiter::for('api', function (Request $request) {
RateLimiter::for('api', function () {
return Limit::perMinute(config('api.apiRequestRatePerMinute', 100))
->by(app('clientIp'));
});

View file

@ -1,6 +1,6 @@
{
"name": "ldc/ldccrm",
"version": "4.0.0",
"version": "4.0.1",
"type": "project",
"description": "LDC CRM",
"license": "MIT",

2826
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -36,8 +36,7 @@ class UserFactory extends Factory
*/
public function unverified(): static
{
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
return $this->state(fn (array $attributes) => [
return $this->state(fn() => [
'email_verified_at' => null,
]);
}