Added_testcase

This commit is contained in:
noor
2023-09-20 12:10:07 +05:30
committed by KNaveenraj-ladybird
parent f2cc9758b0
commit 0bd6f0b257
3 changed files with 26 additions and 19 deletions

View File

@@ -34,3 +34,4 @@
<env name="DB_INSTALL" value="1"/>
</php>
</phpunit>

File diff suppressed because one or more lines are too long

View File

@@ -5,6 +5,7 @@ namespace Tests\Unit;
use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Ticket\Tickets;
use App\User;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Lang;
@@ -14,6 +15,7 @@ class TicketControllerTest extends TestCase
{
use DatabaseTransactions;
/**
* A basic unit test example.
*
@@ -34,6 +36,7 @@ class TicketControllerTest extends TestCase
]);
$user->save();
// Authenticate as the created user
$this->actingAs($user);
$ticket = new Tickets(
@@ -44,7 +47,7 @@ class TicketControllerTest extends TestCase
'sla' => 2,
'help_topic_id' => 1,
'status' => 1,
'source' => 1,
'source' => 1
]
);
$ticket->save();
@@ -62,12 +65,14 @@ class TicketControllerTest extends TestCase
);
$ticket_thread->save();
$mytickets = $this->get(route('ticket2'));
$mytickets->assertStatus(200);
$response = $this->post(route('select_all'), [
'select_all' => [$ticket->id],
'submit' => 'Open',
]);
// Assert that the response status code indicates success
@@ -83,5 +88,6 @@ class TicketControllerTest extends TestCase
$response->assertStatus(302); // Adjust this as needed
$this->assertEquals(3, $ticket->fresh()->status); // Adjust this as needed
$response->assertSessionHas('success', Lang::get('lang.tickets_have_been_closed'));
}
}