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
ad11e11233
commit
d3c8060dfb
@ -202,7 +202,7 @@ class CompanySettings extends BaseSettings
|
||||
public $schedule_reminder2 = ''; // (enum: after_invoice_date, before_due_date, after_due_date) implmemented
|
||||
public $schedule_reminder3 = ''; // (enum: after_invoice_date, before_due_date, after_due_date) implmemented
|
||||
|
||||
public $reminder_send_time = 32400; //number of seconds from UTC +0 to send reminders @TODO
|
||||
public $reminder_send_time = 0; //number of seconds from UTC +0 to send reminders @TODO
|
||||
|
||||
public $late_fee_amount1 = 0; //@implemented
|
||||
public $late_fee_amount2 = 0; //@implemented
|
||||
|
@ -211,8 +211,6 @@ class UserController extends BaseController
|
||||
|
||||
$ct = CreateCompanyToken::dispatchNow($company, $user, $user_agent);
|
||||
|
||||
nlog("in the store method of the usercontroller class");
|
||||
|
||||
event(new UserWasCreated($user, auth()->user(), $company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
$user->setCompany($company);
|
||||
|
@ -46,7 +46,6 @@ class ImportCompanyTest extends TestCase
|
||||
ThrottleRequests::class
|
||||
);
|
||||
|
||||
|
||||
$this->withoutExceptionHandling();
|
||||
|
||||
$this->account = Account::factory()->create();
|
||||
@ -71,6 +70,32 @@ class ImportCompanyTest extends TestCase
|
||||
unlink($backup_json_file);
|
||||
}
|
||||
|
||||
private function unpackZip()
|
||||
{
|
||||
|
||||
$backup_json_file_zip = base_path().'/tests/Feature/Import/backup.zip';
|
||||
|
||||
$zip = new \ZipArchive;
|
||||
$res = $zip->open($backup_json_file_zip);
|
||||
if ($res === TRUE) {
|
||||
$zip->extractTo(sys_get_temp_dir());
|
||||
$zip->close();
|
||||
}
|
||||
|
||||
$backup_json_file = sys_get_temp_dir() . "/backup/backup.json";
|
||||
|
||||
$backup_json_object = json_decode(file_get_contents($backup_json_file));
|
||||
|
||||
return $backup_json_object;
|
||||
}
|
||||
|
||||
private function testAppVersion()
|
||||
{
|
||||
$obj = $this->unpackZip();
|
||||
|
||||
$this->assertEquals("5.1.52", $obj->app_version);
|
||||
}
|
||||
|
||||
public function testImportUsers()
|
||||
{
|
||||
$backup_json_file_zip = base_path().'/tests/Feature/Import/backup.zip';
|
||||
|
@ -109,18 +109,18 @@ class UserTest extends TestCase
|
||||
|
||||
$response = false;
|
||||
|
||||
try {
|
||||
// try {
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
'X-API-PASSWORD' => 'ALongAndBriliantPassword',
|
||||
])->post('/api/v1/users?include=company_user', $data);
|
||||
|
||||
} catch (ValidationException $e) {
|
||||
$message = json_decode($e->validator->getMessageBag(), 1);
|
||||
nlog($message);
|
||||
$this->assertNotNull($message);
|
||||
}
|
||||
// } catch (ValidationException $e) {
|
||||
// $message = json_decode($e->validator->getMessageBag(), 1);
|
||||
// nlog($message);
|
||||
// $this->assertNotNull($message);
|
||||
// }
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
@ -130,7 +130,7 @@ class UserTest extends TestCase
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
'X-API-PASSWORD' => 'ALongAndBriliantPassword',
|
||||
'X-API-PASSWORD' => 'ALongAndBriliantPassword',
|
||||
])->delete('/api/v1/users/'.$this->encodePrimaryKey($user->id).'/detach_from_company?include=company_user');
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
Loading…
x
Reference in New Issue
Block a user