Merge pull request #9577 from turbo124/v5-develop

v5.9.0
This commit is contained in:
David Bomba 2024-06-02 19:32:05 +10:00 committed by GitHub
commit 0a9d0ff9da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 281 additions and 83 deletions

View File

@ -1 +1 @@
5.8.57
5.9.0

View File

@ -70,12 +70,10 @@ class StartupCheck
private function buildTemplates($name = 'templates')
{
$data = [
'invoice' => [
'subject' => EmailTemplateDefaults::emailInvoiceSubject(),
'body' => EmailTemplateDefaults::emailInvoiceTemplate(),
],
'quote' => [
'subject' => EmailTemplateDefaults::emailQuoteSubject(),
'body' => EmailTemplateDefaults::emailQuoteTemplate(),

View File

@ -112,6 +112,7 @@ class NinjaMailerJob implements ShouldQueue
->mailable
->withSymfonyMessage(function ($message) {
$message->getHeaders()->addTextHeader('x-invitation', $this->nmo->invitation->key);
// $message->getHeaders()->addTextHeader('List-Unsubscribe', $this->nmo->mailable->viewData->email_preferences);
});
}

View File

@ -51,6 +51,7 @@ use Laracasts\Presenter\PresentableTrait;
* @property int|null $last_login
* @property int|null $industry_id
* @property int|null $size_id
* @property object|null $e_invoice
* @property string|null $address1
* @property string|null $address2
* @property string|null $city
@ -185,6 +186,7 @@ class Client extends BaseModel implements HasLocalePreference
'deleted_at' => 'timestamp',
'last_login' => 'timestamp',
'tax_data' => 'object',
'e_invoice' => 'object',
];
protected $touches = [];

View File

@ -0,0 +1,100 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Providers;
use App\Models\Bank;
use App\Models\Country;
use App\Models\Currency;
use App\Models\Industry;
use App\Models\Language;
use App\Models\PaymentTerm;
use Illuminate\Support\ServiceProvider;
use App\DataMapper\EmailTemplateDefaults;
class StaticServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
app()->singleton('currencies', function ($app) {
return Currency::query()->orderBy('name')->get();
});
app()->singleton('languages', function ($app) {
return Language::query()->orderBy('name')->get();
});
app()->singleton('countries', function ($app) {
return Country::query()->orderBy('name')->get();
});
app()->singleton('payment_types', function ($app) {
return PaymentTerm::query()->orderBy('num_days')->get();
});
app()->singleton('industries', function ($app) {
return Industry::query()->orderBy('name')->get();
});
app()->singleton('banks', function ($app){
return Bank::query()->orderBy('name')->get();
});
app()->singleton('templates', function ($app){
return [
'invoice' => [
'subject' => EmailTemplateDefaults::emailInvoiceSubject(),
'body' => EmailTemplateDefaults::emailInvoiceTemplate(),
],
'quote' => [
'subject' => EmailTemplateDefaults::emailQuoteSubject(),
'body' => EmailTemplateDefaults::emailQuoteTemplate(),
],
'payment' => [
'subject' => EmailTemplateDefaults::emailPaymentSubject(),
'body' => EmailTemplateDefaults::emailPaymentTemplate(),
],
'reminder1' => [
'subject' => EmailTemplateDefaults::emailReminder1Subject(),
'body' => EmailTemplateDefaults::emailReminder1Template(),
],
'reminder2' => [
'subject' => EmailTemplateDefaults::emailReminder2Subject(),
'body' => EmailTemplateDefaults::emailReminder2Template(),
],
'reminder3' => [
'subject' => EmailTemplateDefaults::emailReminder3Subject(),
'body' => EmailTemplateDefaults::emailReminder3Template(),
],
'reminder_endless' => [
'subject' => EmailTemplateDefaults::emailReminderEndlessSubject(),
'body' => EmailTemplateDefaults::emailReminderEndlessTemplate(),
],
'statement' => [
'subject' => EmailTemplateDefaults::emailStatementSubject(),
'body' => EmailTemplateDefaults::emailStatementTemplate(),
],
];
});
}
public function boot()
{
}
}

View File

@ -11,19 +11,20 @@
namespace App\Services\Email;
use App\DataMapper\EmailTemplateDefaults;
use App\Jobs\Entity\CreateRawPdf;
use App\Jobs\Invoice\CreateUbl;
use App\Models\Task;
use App\Utils\Ninja;
use App\Models\Quote;
use App\Models\Account;
use App\Models\Expense;
use App\Models\Invoice;
use App\Models\PurchaseOrder;
use App\Models\Quote;
use App\Models\Task;
use App\Utils\Ninja;
use App\Jobs\Invoice\CreateUbl;
use App\Utils\Traits\MakesHash;
use Illuminate\Mail\Mailables\Address;
use App\Jobs\Entity\CreateRawPdf;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\URL;
use Illuminate\Mail\Mailables\Address;
use App\DataMapper\EmailTemplateDefaults;
use League\CommonMark\CommonMarkConverter;
class EmailDefaults
@ -388,6 +389,7 @@ class EmailDefaults
{
if ($this->email->email_object->invitation_key) {
$this->email->email_object->headers = array_merge($this->email->email_object->headers, ['x-invitation' => $this->email->email_object->invitation_key]);
// $this->email->email_object->headers = array_merge($this->email->email_object->headers, ['x-invitation' => $this->email->email_object->invitation_key,'List-Unsubscribe' => URL::signedRoute('client.email_preferences', ['entity' => $this->email->email_object->invitation->getEntityString(), 'invitation_key' => $this->email->email_object->invitation->key])]);
}
return $this;

View File

@ -164,6 +164,7 @@ class ClientTransformer extends EntityTransformer
'routing_id' => (string) $client->routing_id,
'tax_info' => $client->tax_data ?: new \stdClass(),
'classification' => $client->classification ?: '',
'e_invoice' => $client->e_invoice ?: new \stdClass(),
];
}
}

View File

@ -72,6 +72,9 @@ class CompanyShopProfileTransformer extends EntityTransformer
'email' => $company->settings->email,
'country_id' => $company->settings->country_id,
'vat_number' => $company->settings->vat_number,
'product' => $company->settings->translations->product ?? ctrans('texts.product'),
'products' => $company->settings->translations->products ?? ctrans('texts.products'),
'client_registration_fields' => $company->client_registration_fields,
];
$new_settings = new stdClass();

86
composer.lock generated
View File

@ -1385,16 +1385,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.308.6",
"version": "3.308.7",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "d119265faba226b3fab1514b6fa27a2986b91453"
"reference": "97074bd8cdd9fe498570821cefa4868fa3353cf3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/d119265faba226b3fab1514b6fa27a2986b91453",
"reference": "d119265faba226b3fab1514b6fa27a2986b91453",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/97074bd8cdd9fe498570821cefa4868fa3353cf3",
"reference": "97074bd8cdd9fe498570821cefa4868fa3353cf3",
"shasum": ""
},
"require": {
@ -1474,9 +1474,9 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.308.6"
"source": "https://github.com/aws/aws-sdk-php/tree/3.308.7"
},
"time": "2024-05-30T18:08:56+00:00"
"time": "2024-05-31T18:17:12+00:00"
},
{
"name": "bacon/bacon-qr-code",
@ -3646,16 +3646,16 @@
},
{
"name": "google/auth",
"version": "v1.39.0",
"version": "v1.40.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-auth-library-php.git",
"reference": "23e8e696d87f8d7dfefbd347ca1c99ce17ecb368"
"reference": "bff9f2d01677e71a98394b5ac981b99523df5178"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/23e8e696d87f8d7dfefbd347ca1c99ce17ecb368",
"reference": "23e8e696d87f8d7dfefbd347ca1c99ce17ecb368",
"url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/bff9f2d01677e71a98394b5ac981b99523df5178",
"reference": "bff9f2d01677e71a98394b5ac981b99523df5178",
"shasum": ""
},
"require": {
@ -3700,9 +3700,9 @@
"support": {
"docs": "https://googleapis.github.io/google-auth-library-php/main/",
"issues": "https://github.com/googleapis/google-auth-library-php/issues",
"source": "https://github.com/googleapis/google-auth-library-php/tree/v1.39.0"
"source": "https://github.com/googleapis/google-auth-library-php/tree/v1.40.0"
},
"time": "2024-05-02T16:03:51+00:00"
"time": "2024-05-31T19:16:15+00:00"
},
{
"name": "graham-campbell/result-type",
@ -4630,16 +4630,16 @@
},
{
"name": "horstoeko/zugferd",
"version": "v1.0.49",
"version": "v1.0.51",
"source": {
"type": "git",
"url": "https://github.com/horstoeko/zugferd.git",
"reference": "bc4f9180c455deae20fb0281b519a550cbfbd1ea"
"reference": "9e036d4a9660638b4f51d2babb397fcff29ef046"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/horstoeko/zugferd/zipball/bc4f9180c455deae20fb0281b519a550cbfbd1ea",
"reference": "bc4f9180c455deae20fb0281b519a550cbfbd1ea",
"url": "https://api.github.com/repos/horstoeko/zugferd/zipball/9e036d4a9660638b4f51d2babb397fcff29ef046",
"reference": "9e036d4a9660638b4f51d2babb397fcff29ef046",
"shasum": ""
},
"require": {
@ -4699,9 +4699,9 @@
],
"support": {
"issues": "https://github.com/horstoeko/zugferd/issues",
"source": "https://github.com/horstoeko/zugferd/tree/v1.0.49"
"source": "https://github.com/horstoeko/zugferd/tree/v1.0.51"
},
"time": "2024-05-30T14:58:49+00:00"
"time": "2024-05-31T17:20:07+00:00"
},
{
"name": "http-interop/http-factory-guzzle",
@ -16788,16 +16788,16 @@
},
{
"name": "brianium/paratest",
"version": "v7.4.4",
"version": "v7.4.5",
"source": {
"type": "git",
"url": "https://github.com/paratestphp/paratest.git",
"reference": "bfe354e71aca261cf37bf70bf47791081100000d"
"reference": "d4de825332842a7dee1ff350f0fd6caafa930d79"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paratestphp/paratest/zipball/bfe354e71aca261cf37bf70bf47791081100000d",
"reference": "bfe354e71aca261cf37bf70bf47791081100000d",
"url": "https://api.github.com/repos/paratestphp/paratest/zipball/d4de825332842a7dee1ff350f0fd6caafa930d79",
"reference": "d4de825332842a7dee1ff350f0fd6caafa930d79",
"shasum": ""
},
"require": {
@ -16813,19 +16813,19 @@
"phpunit/php-timer": "^6.0.0 || ^7.0.0",
"phpunit/phpunit": "^10.5.20 || ^11.1.3",
"sebastian/environment": "^6.1.0 || ^7.1.0",
"symfony/console": "^6.4.7 || ^7.0.7",
"symfony/process": "^6.4.7 || ^7.0.7"
"symfony/console": "^6.4.7 || ^7.1.0",
"symfony/process": "^6.4.7 || ^7.1.0"
},
"require-dev": {
"doctrine/coding-standard": "^12.0.0",
"ext-pcov": "*",
"ext-posix": "*",
"phpstan/phpstan": "^1.10.67",
"phpstan/phpstan-deprecation-rules": "^1.1.4",
"phpstan/phpstan-phpunit": "^1.3.16",
"phpstan/phpstan-strict-rules": "^1.5.5",
"squizlabs/php_codesniffer": "^3.9.2",
"symfony/filesystem": "^6.4.3 || ^7.0.7"
"phpstan/phpstan": "^1.11.2",
"phpstan/phpstan-deprecation-rules": "^1.2.0",
"phpstan/phpstan-phpunit": "^1.4.0",
"phpstan/phpstan-strict-rules": "^1.6.0",
"squizlabs/php_codesniffer": "^3.10.1",
"symfony/filesystem": "^6.4.3 || ^7.1.0"
},
"bin": [
"bin/paratest",
@ -16866,7 +16866,7 @@
],
"support": {
"issues": "https://github.com/paratestphp/paratest/issues",
"source": "https://github.com/paratestphp/paratest/tree/v7.4.4"
"source": "https://github.com/paratestphp/paratest/tree/v7.4.5"
},
"funding": [
{
@ -16878,7 +16878,7 @@
"type": "paypal"
}
],
"time": "2024-05-03T13:01:49+00:00"
"time": "2024-05-31T13:59:20+00:00"
},
{
"name": "clue/ndjson-react",
@ -16946,16 +16946,16 @@
},
{
"name": "composer/class-map-generator",
"version": "1.1.1",
"version": "1.3.2",
"source": {
"type": "git",
"url": "https://github.com/composer/class-map-generator.git",
"reference": "8286a62d243312ed99b3eee20d5005c961adb311"
"reference": "acd227952154850d0bb7d65caa4f9edf9cd806a7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/class-map-generator/zipball/8286a62d243312ed99b3eee20d5005c961adb311",
"reference": "8286a62d243312ed99b3eee20d5005c961adb311",
"url": "https://api.github.com/repos/composer/class-map-generator/zipball/acd227952154850d0bb7d65caa4f9edf9cd806a7",
"reference": "acd227952154850d0bb7d65caa4f9edf9cd806a7",
"shasum": ""
},
"require": {
@ -16999,7 +16999,7 @@
],
"support": {
"issues": "https://github.com/composer/class-map-generator/issues",
"source": "https://github.com/composer/class-map-generator/tree/1.1.1"
"source": "https://github.com/composer/class-map-generator/tree/1.3.2"
},
"funding": [
{
@ -17015,7 +17015,7 @@
"type": "tidelift"
}
],
"time": "2024-03-15T12:53:41+00:00"
"time": "2024-05-31T19:45:56+00:00"
},
{
"name": "composer/pcre",
@ -18240,16 +18240,16 @@
},
{
"name": "phpstan/phpstan",
"version": "1.11.2",
"version": "1.11.3",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "0d5d4294a70deb7547db655c47685d680e39cfec"
"reference": "e64220a05c1209fc856d58e789c3b7a32c0bb9a5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/0d5d4294a70deb7547db655c47685d680e39cfec",
"reference": "0d5d4294a70deb7547db655c47685d680e39cfec",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/e64220a05c1209fc856d58e789c3b7a32c0bb9a5",
"reference": "e64220a05c1209fc856d58e789c3b7a32c0bb9a5",
"shasum": ""
},
"require": {
@ -18294,7 +18294,7 @@
"type": "github"
}
],
"time": "2024-05-24T13:23:04+00:00"
"time": "2024-05-31T13:53:37+00:00"
},
{
"name": "phpunit/php-code-coverage",

View File

@ -201,6 +201,7 @@ return [
App\Providers\MultiDBProvider::class,
App\Providers\ClientPortalServiceProvider::class,
App\Providers\NinjaTranslationServiceProvider::class,
// App\Providers\StaticServiceProvider::class,
],
/*

View File

@ -17,8 +17,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => env('APP_VERSION', '5.8.58'),
'app_tag' => env('APP_TAG', '5.8.58'),
'app_version' => env('APP_VERSION', '5.9.0'),
'app_tag' => env('APP_TAG', '5.9.0'),
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false),

View File

@ -36,7 +36,6 @@ return new class extends Migration
$table->mediumText('e_invoice')->nullable();
});
Schema::table('accounts', function (Blueprint $table) {
$table->integer('email_quota')->default(20)->nullable();
});

View File

@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('clients', function (Blueprint $table) {
$table->mediumText('e_invoice')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
}
};

View File

@ -15,22 +15,22 @@
<table class="min-w-full shadow rounded border border-gray-200 mt-4 credits-table bg-white">
<thead>
<tr>
<th class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-primary">
<th class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-primary task_description">
<span role="button" wire:click="sortBy('description')" class="cursor-pointer">
{{ ctrans('texts.description') }}
</span>
</th>
<th class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-primary">
<th class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-primary task_project">
<span role="button" wire:click="sortBy('description')" class="cursor-pointer">
{{ ctrans('texts.project') }}
</span>
</th>
<th class="px-6 py-3 border-b border-gray-200 bg-primary text-left text-xs leading-4 font-medium text-white uppercase tracking-wider">
<th class="px-6 py-3 border-b border-gray-200 bg-primary text-left text-xs leading-4 font-medium text-white uppercase tracking-wider task_status">
<span role="button" wire:click="sortBy('status_id')" class="cursor-pointer">
{{ ctrans('texts.status') }}
</span>
</th>
<th class="px-6 py-3 border-b border-gray-200 bg-primary text-left text-xs leading-4 font-medium text-white uppercase tracking-wider">
<th class="px-6 py-3 border-b border-gray-200 bg-primary text-left text-xs leading-4 font-medium text-white uppercase tracking-wider task_duration">
<span role="button" class="cursor-pointer">
{{ ctrans('texts.duration') }}
</span>
@ -40,13 +40,13 @@
<tbody>
@foreach($tasks as $task)
<tr class="bg-white group hover:bg-gray-100">
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500 task_descripton">
{{ \Illuminate\Support\Str::limit($task->description, 80) }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500 task_project">
{{ $task->project?->name }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500 task_status">
<div class="flex">
{!! $task->stringStatus() !!}
@ -59,7 +59,7 @@
@endif
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500 task_duration">
{{ \Carbon\CarbonInterval::seconds($task->calcDuration())->cascade()->forHumans() }}
</td>
</tr>
@ -68,17 +68,17 @@
<table class="min-w-full ml-5">
<thead>
<tr>
<th class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-gray-500">
<th class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-gray-500 task_date">
<span>
{{ ctrans('texts.date') }}
</span>
</th>
<th class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-gray-500">
<th class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-gray-500 task_duration">
<span>
{{ ctrans('texts.duration') }}
</span>
</th>
<th colspan="4" class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-gray-500">
<th colspan="4" class="px-6 py-3 text-xs font-medium leading-4 tracking-wider text-left text-white uppercase border-b border-gray-200 bg-gray-500 task_description">
<span>
{{ ctrans('texts.description') }}
</span>
@ -89,13 +89,13 @@
@foreach($task->processLogsExpandedNotation() as $log)
@if(strlen($log['description']) > 1)
<tr class="bg-white group border-b border-gray-100">
<td class="px-6 py-4 text-sm leading-5 text-gray-500 w-1/6">
<td class="px-6 py-4 text-sm leading-5 text-gray-500 w-1/6 task_date">
{{ $log['start_date']}}
</td>
<td class="px-6 py-4 text-sm leading-5 text-gray-500 w-1/6">
<td class="px-6 py-4 text-sm leading-5 text-gray-500 w-1/6 task_duration">
{{ $log['duration']}}
</td>
<td colspan="4" class="px-6 py-4 text-sm leading-5 text-gray-500 w-4/6">
<td colspan="4" class="px-6 py-4 text-sm leading-5 text-gray-500 w-4/6 task_description">
{!! nl2br(e($log['description'])) !!}
</td>
</tr>

View File

@ -28,6 +28,8 @@ class BankIntegrationApiTest extends TestCase
use DatabaseTransactions;
use MockAccountData;
protected $faker;
protected function setUp() :void
{
parent::setUp();

View File

@ -60,6 +60,7 @@ class DesignApiTest extends TestCase
$q = Design::query()
->where('is_template', true)
->where('company_id', $this->company->id)
->whereRaw('FIND_IN_SET( ? ,entities)', [$searchable]);
$this->assertEquals(1, $q->count());

View File

@ -11,17 +11,18 @@
namespace Tests\Feature\Notify;
use App\DataMapper\CompanySettings;
use App\Models\CompanyToken;
use App\Models\CompanyUser;
use App\Models\Invoice;
use App\Models\InvoiceInvitation;
use App\Models\Product;
use App\Models\User;
use App\Utils\Traits\Notifications\UserNotifies;
use Illuminate\Support\Str;
use Tests\MockAccountData;
use Tests\TestCase;
use App\Models\User;
use App\Models\Invoice;
use App\Models\Product;
use Tests\MockAccountData;
use App\Models\CompanyUser;
use Illuminate\Support\Str;
use App\Models\CompanyToken;
use App\Models\InvoiceInvitation;
use App\DataMapper\CompanySettings;
use App\Utils\Traits\Notifications\UserNotifies;
use Illuminate\Routing\Middleware\ThrottleRequests;
/**
* @test
@ -32,6 +33,8 @@ class NotificationTest extends TestCase
use UserNotifies;
use MockAccountData;
protected $faker;
protected function setUp() :void
{
parent::setUp();

View File

@ -27,6 +27,7 @@ class ShopInvoiceTest extends TestCase
{
use MakesHash;
use MockAccountData;
protected $faker;
protected function setUp() :void
{

View File

@ -48,4 +48,60 @@ class ShopProfileTest extends TestCase
$this->assertArrayHasKey('custom_value1', $arr['data']['settings']);
$this->assertEquals($this->company->company_key, $arr['data']['company_key']);
}
public function testProfileSettingsUpdate()
{
$this->company->enable_shop_api = true;
$settings = $this->company->settings;
$trans = new \stdClass;
$trans->product = "Service";
$trans->products = "Services";
$settings->translations = $trans;
$this->company->settings = $settings;
$this->company->save();
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-COMPANY-KEY' => $this->company->company_key,
])->getJson('/api/v1/shop/profile');
$response->assertStatus(200);
$arr = $response->json();
$this->assertEquals("Service", $arr['data']['settings']['product']);
$this->assertEquals("Services", $arr['data']['settings']['products']);
}
public function testProfileSettingsUpdate2()
{
$this->company->enable_shop_api = true;
$this->company->save();
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-COMPANY-KEY' => $this->company->company_key,
])->getJson('/api/v1/shop/profile');
$response->assertStatus(200);
$arr = $response->json();
$this->assertEquals("Product", $arr['data']['settings']['product']);
$this->assertEquals("Products", $arr['data']['settings']['products']);
$this->assertIsArray($arr['data']['settings']['client_registration_fields']);
}
}

View File

@ -11,12 +11,13 @@
namespace Tests\Unit\ValidationRules;
use App\Http\Requests\Invoice\StoreInvoiceRequest;
use Tests\TestCase;
use App\Models\Invoice;
use Tests\MockAccountData;
use App\Utils\Traits\MakesHash;
use Illuminate\Support\Facades\Validator;
use Tests\MockAccountData;
use Tests\TestCase;
use App\Http\Requests\Invoice\StoreInvoiceRequest;
use Illuminate\Routing\Middleware\ThrottleRequests;
/**
* @test