Fixes for query grammar

This commit is contained in:
David Bomba 2023-08-21 13:38:57 +10:00
parent cd06dc551a
commit a6d7584e14
4 changed files with 12 additions and 10 deletions

View File

@ -734,7 +734,7 @@ class BaseImport
{ {
$user = User::where('account_id', $this->company->account->id) $user = User::where('account_id', $this->company->account->id)
->where( ->where(
\DB::raw('CONCAT_WS(" ", first_name, last_name)')->getValue(DB::connection()->getQueryGrammar()), \DB::raw('CONCAT_WS(" ", first_name, last_name)')->getValue(\DB::connection()->getQueryGrammar()),
'like', 'like',
'%'.$user_hash.'%' '%'.$user_hash.'%'
) )

View File

@ -124,8 +124,8 @@ class CompanyGatewayResolutionTest extends TestCase
$amount = 10; $amount = 10;
$this->assertInstanceOf('\\stdClass', $this->cg->fees_and_limits); $this->assertInstanceOf('\\stdClass', $this->cg->fees_and_limits);
$this->assertObjectHasAttribute('min_limit', $this->cg->fees_and_limits->{1}); // $this->assertObjectHasAttribute('min_limit', $this->cg->fees_and_limits->{1});
$this->assertNotNull($this->cg->fees_and_limits->{1}->min_limit);
$payment_methods = $this->client->service()->getPaymentMethods($amount); $payment_methods = $this->client->service()->getPaymentMethods($amount);
$this->assertEquals(2, count($payment_methods)); $this->assertEquals(2, count($payment_methods));

View File

@ -17,7 +17,7 @@ use App\Models\Invoice;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Foundation\Testing\WithoutEvents; // use Illuminate\Foundation\Testing\WithoutEvents;
use Illuminate\Routing\Middleware\ThrottleRequests; use Illuminate\Routing\Middleware\ThrottleRequests;
use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Session;
use Tests\MockAccountData; use Tests\MockAccountData;
@ -31,7 +31,7 @@ class EntityPaidToDateTest extends TestCase
use MakesHash; use MakesHash;
use DatabaseTransactions; use DatabaseTransactions;
use MockAccountData; use MockAccountData;
use WithoutEvents; // use WithoutEvents;
protected function setUp() :void protected function setUp() :void
{ {

View File

@ -15,6 +15,7 @@ use Tests\TestCase;
use App\Models\Quote; use App\Models\Quote;
use App\Models\Invoice; use App\Models\Invoice;
use Tests\MockAccountData; use Tests\MockAccountData;
use App\Models\PurchaseOrder;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use App\Events\Task\TaskWasCreated; use App\Events\Task\TaskWasCreated;
use App\Events\Task\TaskWasDeleted; use App\Events\Task\TaskWasDeleted;
@ -93,6 +94,8 @@ class EventTest extends TestCase
use MakesHash; use MakesHash;
use DatabaseTransactions; use DatabaseTransactions;
public $faker;
public function setUp(): void public function setUp(): void
{ {
parent::setUp(); parent::setUp();
@ -586,7 +589,7 @@ class EventTest extends TestCase
'X-API-TOKEN' => $this->token, 'X-API-TOKEN' => $this->token,
])->postJson('/api/v1/recurring_invoices/', $data); ])->postJson('/api/v1/recurring_invoices/', $data);
} catch (ValidationException $e) { } catch (ValidationException $e) {
$message = json_decode($e->validator->getMessageBag(), 1); // $message = json_decode($e->validator->getMessageBag(), 1);
} }
$response->assertStatus(200); $response->assertStatus(200);
@ -846,17 +849,16 @@ class EventTest extends TestCase
} }
public function PurchaseOrderEvents() public function testPurchaseOrderEvents()
{ {
/* Test fire new invoice */ /* Test fire new invoice */
$data = [ $data = [
'client_id' => $this->vendor->hashed_id, 'vendor_id' => $this->vendor->hashed_id,
'number' => 'dude', 'number' => 'dude',
]; ];
Event::fake(); Event::fake();
$response = $this->withHeaders([ $response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'), 'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token, 'X-API-TOKEN' => $this->token,
@ -867,7 +869,7 @@ class EventTest extends TestCase
$arr = $response->json(); $arr = $response->json();
$data = [ $data = [
'client_id' => $this->vendor->hashed_id, 'vendor_id' => $this->vendor->hashed_id,
'number' => 'dude2', 'number' => 'dude2',
]; ];