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