mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for tests
This commit is contained in:
parent
6854c6c1f9
commit
0a1b4b26b9
@ -160,7 +160,8 @@ class MultiDB
|
||||
public static function userFindAndSetDb($email) : bool
|
||||
{
|
||||
|
||||
//multi-db active
|
||||
//multi-db active
|
||||
|
||||
foreach (self::$dbs as $db) {
|
||||
if (User::on($db)->where(['email' => $email])->get()->count() >= 1) { // if user already exists, validation will fail
|
||||
return true;
|
||||
@ -172,6 +173,8 @@ class MultiDB
|
||||
|
||||
public static function findAndSetDb($token) :bool
|
||||
{
|
||||
nlog($token);
|
||||
|
||||
foreach (self::$dbs as $db) {
|
||||
if ($ct = CompanyToken::on($db)->whereRaw('BINARY `token`= ?', [$token])->first()) {
|
||||
self::setDb($ct->company->db);
|
||||
|
@ -22,7 +22,7 @@
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="MAIL_MAILER" value="array"/>
|
||||
<env name="DB_CONNECTION" value="sqlite"/>
|
||||
<env name="DB_CONNECTION" value="mysql"/>
|
||||
<env name="DB_DATABASE" value=":memory:"/>
|
||||
</php>
|
||||
<logging/>
|
||||
|
@ -34,6 +34,7 @@ class InvitationTest extends TestCase
|
||||
|
||||
public function testInvitationSanity()
|
||||
{
|
||||
|
||||
$this->assertEquals($this->invoice->invitations->count(), 2);
|
||||
|
||||
$invitations = $this->invoice->invitations()->get();
|
||||
@ -46,11 +47,20 @@ class InvitationTest extends TestCase
|
||||
|
||||
$this->invoice->line_items = [];
|
||||
|
||||
$response = null;
|
||||
|
||||
try {
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->put('/api/v1/invoices/'.$this->encodePrimaryKey($this->invoice->id), $this->invoice->toArray())
|
||||
->assertStatus(200);
|
||||
])->put('/api/v1/invoices/'.$this->encodePrimaryKey($this->invoice->id), $this->invoice->toArray());
|
||||
} catch (\Exception $e) {
|
||||
|
||||
nlog($e->getMessage());
|
||||
}
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user