Skip to content

Commit

Permalink
Merge pull request #64 from Newman101/feature/further-unit-test-coverage
Browse files Browse the repository at this point in the history
Further Unit Test Coverage
  • Loading branch information
jremes-foss committed Jun 17, 2021
2 parents 1c638ab + 15a8c21 commit d489915
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tests/Unit/ApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tests\Unit;

use App\Category;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
Expand Down Expand Up @@ -122,9 +121,9 @@ public function testApiInterface()

public function testGetTeams()
{
$user = factory(\App\User::class)->create();
$teams = new ApiController();
$teams->getTeams();
$this->assertEquals('object', gettype($teams));
factory(\App\Team::class)->create();
$teamsController = new ApiController();
$teams = $teamsController->getTeams();
$this->assertEquals('array', gettype($teams));
}
}
25 changes: 25 additions & 0 deletions tests/Unit/RedirectIfAuthenticatedTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Tests\Unit;

use Tests\TestCase;
use App\User;
use Illuminate\Foundation\Testing\RefreshDatabase;

class RedirectIfAuthenticatedTest extends TestCase
{
use RefreshDatabase;

public function testNotAuthenticated()
{
$response = $this->get('/login');
$response->assertStatus(200);
}

public function testAuthenticated()
{
$user = factory(User::class)->create();
$response = $this->actingAs($user)->get('/login');
$response->assertRedirect('/home');
}
}

0 comments on commit d489915

Please sign in to comment.