mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for tests - base PHP version now 7.3
This commit is contained in:
parent
1241f14063
commit
60e0e84980
@ -58,18 +58,15 @@ class CreateAccount
|
|||||||
* Create company
|
* Create company
|
||||||
*/
|
*/
|
||||||
$company = CreateCompany::dispatchNow($this->request, $account);
|
$company = CreateCompany::dispatchNow($this->request, $account);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set default company
|
* Set default company
|
||||||
*/
|
*/
|
||||||
$account->default_company_id = $company->id;
|
$account->default_company_id = $company->id;
|
||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create user
|
* Create user
|
||||||
*/
|
*/
|
||||||
$user = CreateUser::dispatchNow($this->request, $account, $company, true); //make user company_owner
|
$user = CreateUser::dispatchNow($this->request, $account, $company, true); //make user company_owner
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Required dependencies
|
* Required dependencies
|
||||||
*/
|
*/
|
||||||
@ -77,23 +74,20 @@ class CreateAccount
|
|||||||
auth()->login($user, false);
|
auth()->login($user, false);
|
||||||
|
|
||||||
$user->setCompany($company);
|
$user->setCompany($company);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create token
|
* Create token
|
||||||
*/
|
*/
|
||||||
$company_token = CreateCompanyToken::dispatchNow($company, $user);
|
$company_token = CreateCompanyToken::dispatchNow($company, $user);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Login user
|
* Login user
|
||||||
*/
|
*/
|
||||||
//Auth::loginUsingId($user->id, true);
|
//Auth::loginUsingId($user->id, true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fire related events
|
* Fire related events
|
||||||
*/
|
*/
|
||||||
if($user)
|
if($user)
|
||||||
event(new AccountCreated($user));
|
event(new AccountCreated($user));
|
||||||
|
|
||||||
return $account;
|
return $account;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ use App\Models\User;
|
|||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class CreateUser
|
class CreateUser
|
||||||
{
|
{
|
||||||
@ -30,6 +31,8 @@ class CreateUser
|
|||||||
|
|
||||||
protected $company;
|
protected $company;
|
||||||
|
|
||||||
|
protected $company_owner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new job instance.
|
* Create a new job instance.
|
||||||
*
|
*
|
||||||
|
@ -40,7 +40,7 @@ class CreatedUserActivity
|
|||||||
|
|
||||||
$fields = new \stdClass;
|
$fields = new \stdClass;
|
||||||
|
|
||||||
if(auth()->user()->id)
|
if(auth()->user())
|
||||||
$fields->user_id = auth()->user()->id;
|
$fields->user_id = auth()->user()->id;
|
||||||
else
|
else
|
||||||
$fields->user_id = $event->user->id;
|
$fields->user_id = $event->user->id;
|
||||||
|
@ -29,7 +29,7 @@ class BaseModel extends Model
|
|||||||
///const CREATED_AT = 'creation_date';
|
///const CREATED_AT = 'creation_date';
|
||||||
//const UPDATED_AT = 'last_update';
|
//const UPDATED_AT = 'last_update';
|
||||||
|
|
||||||
//protected $dateFormat = 'Y-m-d H:i:s.u';
|
protected $dateFormat = 'Y-m-d H:i:s.u';
|
||||||
|
|
||||||
public function __call($method, $params)
|
public function __call($method, $params)
|
||||||
{
|
{
|
||||||
|
@ -37,6 +37,9 @@ class ClientContact extends Authenticatable
|
|||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected $dates = ['deleted_at'];
|
||||||
|
|
||||||
|
protected $dateFormat = 'Y-m-d H:i:s.u';
|
||||||
|
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'first_name',
|
'first_name',
|
||||||
'last_name',
|
'last_name',
|
||||||
|
@ -19,14 +19,13 @@ class CompanyUser extends Pivot
|
|||||||
{
|
{
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be cast to native types.
|
* The attributes that should be cast to native types.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'settings' => 'collection',
|
'settings' => 'object',
|
||||||
'permissions' => 'object',
|
'permissions' => 'object',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -45,6 +45,8 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||||||
|
|
||||||
protected $with = ['companies','user_companies'];
|
protected $with = ['companies','user_companies'];
|
||||||
|
|
||||||
|
protected $dateFormat = 'Y-m-d H:i:s.u';
|
||||||
|
|
||||||
public $company;
|
public $company;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,6 +79,11 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||||||
'slack_webhook_url',
|
'slack_webhook_url',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'settings' => 'object',
|
||||||
|
'permissions' => 'object',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a account.
|
* Returns a account.
|
||||||
*
|
*
|
||||||
@ -105,6 +112,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||||||
public function companies()
|
public function companies()
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(Company::class)->using(CompanyUser::class)->withPivot('permissions', 'settings', 'is_admin', 'is_owner', 'is_locked');
|
return $this->belongsToMany(Company::class)->using(CompanyUser::class)->withPivot('permissions', 'settings', 'is_admin', 'is_owner', 'is_locked');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -172,8 +172,6 @@ class CreateUsersTable extends Migration
|
|||||||
$table->boolean('is_owner')->default(false);
|
$table->boolean('is_owner')->default(false);
|
||||||
$table->boolean('is_admin');
|
$table->boolean('is_admin');
|
||||||
$table->boolean('is_locked')->default(false); // locks user out of account
|
$table->boolean('is_locked')->default(false); // locks user out of account
|
||||||
$table->timestamps(6);
|
|
||||||
$table->softDeletes();
|
|
||||||
|
|
||||||
$table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
|
$table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
|
||||||
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\DataMapper\DefaultSettings;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\ClientContact;
|
use App\Models\ClientContact;
|
||||||
@ -52,6 +53,8 @@ class RandomDataSeeder extends Seeder
|
|||||||
'is_owner' => 1,
|
'is_owner' => 1,
|
||||||
'is_admin' => 1,
|
'is_admin' => 1,
|
||||||
'is_locked' => 0,
|
'is_locked' => 0,
|
||||||
|
'permissions' => json_encode([]),
|
||||||
|
'settings' => json_encode(DefaultSettings::userSettings()),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$client = factory(\App\Models\Client::class)->create([
|
$client = factory(\App\Models\Client::class)->create([
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
"hashids": "^1.2.2",
|
"hashids": "^1.2.2",
|
||||||
"laravel-echo": "^1.4.0",
|
"laravel-echo": "^1.4.0",
|
||||||
"lodash.get": "^4.4.2",
|
"lodash.get": "^4.4.2",
|
||||||
"puppeteer": "^1.15.0",
|
"puppeteer": "^1.18.1",
|
||||||
"quill": "^1.3.6",
|
"quill": "^1.3.6",
|
||||||
"socket.io-client": "^2.1.1",
|
"socket.io-client": "^2.1.1",
|
||||||
"ts-loader": "3.5.0",
|
"ts-loader": "3.5.0",
|
||||||
|
@ -64,7 +64,7 @@ class ClientTest extends TestCase
|
|||||||
|
|
||||||
$acc = $response->json();
|
$acc = $response->json();
|
||||||
|
|
||||||
|
Log::error($acc);
|
||||||
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
$account = Account::find($this->decodePrimaryKey($acc['data']['id']));
|
||||||
|
|
||||||
$token = $account->default_company->tokens->first()->token;
|
$token = $account->default_company->tokens->first()->token;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user