-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from Newman101/IncreaseCoverage
Increase Test Coverage
- Loading branch information
Showing
5 changed files
with
77 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Tests\Feature; | ||
|
||
use Tests\TestCase; | ||
use Illuminate\Foundation\Testing\WithFaker; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
use Artisan; | ||
|
||
class AdminConsoleTest extends TestCase | ||
{ | ||
public function testAdminConsoleCommandExists() | ||
{ | ||
$this->assertTrue(class_exists(\App\Console\Commands\CreateAdministrator::class)); | ||
} | ||
|
||
public function testRunAdminConsoleCommandNoInteraction() | ||
{ | ||
$cmd = Artisan::call('user:create-admin', ['--no-interaction' => true]); | ||
$this->assertEquals(0, $cmd); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Tests\Unit; | ||
|
||
use Tests\TestCase; | ||
use Illuminate\Foundation\Testing\WithFaker; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
use App\Attachment; | ||
use App\Challenge; | ||
|
||
class AttachmentTest extends TestCase | ||
{ | ||
use RefreshDatabase; | ||
|
||
public function testAttachmentRelationship() | ||
{ | ||
$attachment = factory(Attachment::class)->make([ | ||
'challenge_id' => 1, | ||
'filename' => 'test.zip', | ||
'url' => 'http://127.0.0.1' | ||
]); | ||
|
||
factory(\App\Challenge::class)->create([ | ||
'category' => 'Crypto', | ||
'score' => '250', | ||
'title' => 'TEST', | ||
'flag' => 'FLAG{th1s_1s_4_t3stSt}', | ||
'content' => 'This is a test.' | ||
]); | ||
|
||
$challenge = $attachment->challenge; | ||
$this->assertEquals('TEST', $challenge->title); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters