Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove down migration #44

Merged
merged 4 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions database/migrations/create_tickets_table.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,4 @@ return new class extends Migration
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('laravel_tickets');
}
};
4 changes: 2 additions & 2 deletions src/Models/Ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
*/
class Ticket extends Model
{
use Concerns\InteractsWithTicketRelations;
use Concerns\InteractsWithTickets;
use HasFactory;
use TicketScope;
use Concerns\InteractsWithTickets;
use Concerns\InteractsWithTicketRelations;

/**
* The attributes that aren't mass assignable.
Expand Down
90 changes: 45 additions & 45 deletions tests/Feature/TicketTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@

it('filters tickets by status', function () {
Ticket::factory()
->times(3)
->create([
'status' => 'open',
]);
->times(3)
->create([
'status' => 'open',
]);

Ticket::factory()
->times(7)
->create([
'status' => 'closed',
]);
->times(7)
->create([
'status' => 'closed',
]);

Ticket::factory()
->times(6)
->create([
'status' => 'archived',
]);
->times(6)
->create([
'status' => 'archived',
]);

$this->assertEquals(Ticket::count(), 16);
$this->assertEquals(Ticket::opened()->count(), 3);
Expand All @@ -31,16 +31,16 @@

it('filters tickets by resolved status', function () {
Ticket::factory()
->times(2)
->create([
'is_resolved' => true,
]);
->times(2)
->create([
'is_resolved' => true,
]);

Ticket::factory()
->times(10)
->create([
'is_resolved' => false,
]);
->times(10)
->create([
'is_resolved' => false,
]);

$this->assertEquals(Ticket::count(), 12);
$this->assertEquals(Ticket::resolved()->count(), 2);
Expand All @@ -49,16 +49,16 @@

it('filters tickets by locked status', function () {
Ticket::factory()
->times(3)
->create([
'is_locked' => true,
]);
->times(3)
->create([
'is_locked' => true,
]);

Ticket::factory()
->times(9)
->create([
'is_locked' => false,
]);
->times(9)
->create([
'is_locked' => false,
]);

$this->assertEquals(Ticket::count(), 12);
$this->assertEquals(Ticket::locked()->count(), 3);
Expand All @@ -67,28 +67,28 @@

it('filters tickets by priority status', function () {
Ticket::factory()
->times(7)
->create([
'priority' => 'low',
]);
->times(7)
->create([
'priority' => 'low',
]);

Ticket::factory()
->times(5)
->create([
'priority' => 'normal',
]);
->times(5)
->create([
'priority' => 'normal',
]);

Ticket::factory()
->times(15)
->create([
'priority' => 'high',
]);
->times(15)
->create([
'priority' => 'high',
]);

Ticket::factory()
->times(15)
->create([
'priority' => 'something else',
]);
->times(15)
->create([
'priority' => 'something else',
]);

$this->assertEquals(Ticket::count(), 42);
$this->assertEquals(Ticket::withLowPriority()->count(), 7);
Expand Down Expand Up @@ -246,7 +246,7 @@
]);

$ticket->archive()
->markAsLocked();
->markAsLocked();

$this->assertTrue($ticket->isArchived());
$this->assertTrue($ticket->isLocked());
Expand Down
6 changes: 3 additions & 3 deletions tests/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\Access\Authorizable;

class User extends Model implements CanUseTickets, AuthenticatableContract, AuthorizableContract, CanResetPasswordContract
class User extends Model implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract, CanUseTickets
{
use Authenticatable,
Authorizable,
CanResetPassword,
MustVerifyEmail,
HasFactory,
HasTickets;
HasTickets,
MustVerifyEmail;

protected $guarded = [];
}
8 changes: 4 additions & 4 deletions tests/Unit/LabelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
$ticket = Ticket::factory()->create();

$label = Label::factory()
->create([
'name' => 'Support',
'slug' => 'supoort',
]);
->create([
'name' => 'Support',
'slug' => 'supoort',
]);

$tableName = config(
'laravel_ticket.table_names.labels',
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
);

$message = Message::factory()
->create([
$tableName['columns']['ticket_foreing_id'] => $ticket->id,
'message' => 'Message from a ticket',
]);
->create([
$tableName['columns']['ticket_foreing_id'] => $ticket->id,
'message' => 'Message from a ticket',
]);

$this->assertDatabaseHas($tableName['table'], [
$tableName['columns']['ticket_foreing_id'] => $ticket->id,
Expand Down
Loading