2020-01-16 16:49:36 +03:00
|
|
|
<?php
|
2023-05-03 00:08:35 +03:00
|
|
|
|
2020-01-16 16:49:36 +03:00
|
|
|
namespace Tests\Feature\Wizard;
|
|
|
|
|
|
|
|
use Illuminate\Http\UploadedFile;
|
|
|
|
use Tests\Feature\FeatureTestCase;
|
|
|
|
|
|
|
|
class CompaniesTest extends FeatureTestCase
|
|
|
|
{
|
|
|
|
public function testItShouldSeeCompanyUpdatePage()
|
|
|
|
{
|
|
|
|
$this->loginAs()
|
|
|
|
->get(route('wizard.companies.edit'))
|
|
|
|
->assertStatus(200)
|
2021-05-29 19:40:43 +03:00
|
|
|
->assertSeeText(trans('general.wizard'));
|
2020-01-16 16:49:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testItShouldUpdateCompany()
|
|
|
|
{
|
|
|
|
$request = $this->getRequest();
|
|
|
|
|
2021-05-29 19:17:48 +03:00
|
|
|
$message = trans('messages.success.updated', ['type' => trans_choice('general.companies', 2)]);
|
|
|
|
|
2020-01-16 16:49:36 +03:00
|
|
|
$this->loginAs()
|
2021-05-29 17:57:45 +03:00
|
|
|
->post(route('wizard.companies.update'), $request)
|
2021-05-29 19:17:48 +03:00
|
|
|
->assertStatus(200)
|
|
|
|
->assertJson([
|
|
|
|
'success' => true,
|
|
|
|
'message' => $message,
|
|
|
|
]);
|
2020-01-16 16:49:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getRequest()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'financial_start' => '01-04',
|
|
|
|
'address' => $this->faker->address,
|
|
|
|
'tax_number' => $this->faker->randomNumber(9),
|
2021-07-13 17:34:08 +03:00
|
|
|
'logo' => UploadedFile::fake()->image('akaunting-logo.jpg'),
|
2020-01-16 16:49:36 +03:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|