mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Test for new shop routes"
This commit is contained in:
parent
e183238b8e
commit
13cf06b0cd
@ -29,7 +29,7 @@ class ProfileController extends BaseController
|
||||
protected $entity_transformer = CompanyShopProfileTransformer::class;
|
||||
|
||||
|
||||
public function show(Request $request, string $product_key)
|
||||
public function show(Request $request)
|
||||
{
|
||||
$company = Company::where('company_key', $request->header('X-API-COMPANY-KEY'))->first();
|
||||
|
||||
|
@ -36,6 +36,7 @@ use App\Transformers\CompanyLedgerTransformer;
|
||||
use App\Transformers\CompanyTokenHashedTransformer;
|
||||
use App\Transformers\CompanyTokenTransformer;
|
||||
use App\Transformers\CreditTransformer;
|
||||
use App\Transformers\EntityTransformer;
|
||||
use App\Transformers\PaymentTermTransformer;
|
||||
use App\Transformers\TaskTransformer;
|
||||
use App\Transformers\WebhookTransformer;
|
||||
|
52
tests/Unit/Shop/ShopProfileTest.php
Normal file
52
tests/Unit/Shop/ShopProfileTest.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Shop;
|
||||
|
||||
use App\Factory\InvoiceFactory;
|
||||
use App\Factory\InvoiceItemFactory;
|
||||
use App\Helpers\Invoice\InvoiceSum;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\MockAccountData;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @covers \App\Http\Controllers\Shop\ProfileController
|
||||
*/
|
||||
class ShopProfileTest extends TestCase
|
||||
{
|
||||
use MockAccountData;
|
||||
use DatabaseTransactions;
|
||||
|
||||
|
||||
|
||||
public function setUp() :void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->makeTestData();
|
||||
}
|
||||
|
||||
public function testProfileDisplays()
|
||||
{
|
||||
|
||||
$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
|
||||
])->get('/api/v1/shop/profile');
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertArrayHasKey('custom_value1', $arr['data']['settings']);
|
||||
$this->assertEquals($this->company->company_key, $arr['data']['company_key']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user