mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Extract CanSkipTests trait
This commit is contained in:
parent
ab45975883
commit
45f5eaac5b
|
@ -482,16 +482,10 @@ class AssetStoreTest extends TestCase
|
|||
});
|
||||
}
|
||||
|
||||
public function markIncompleteIfMySQL()
|
||||
{
|
||||
if (config('database.default') === 'mysql') {
|
||||
$this->markTestIncomplete('Custom Fields tests do not work on MySQL');
|
||||
}
|
||||
}
|
||||
|
||||
public function testEncryptedCustomFieldCanBeStored()
|
||||
{
|
||||
$this->markIncompleteIfMySQL();
|
||||
$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');
|
||||
|
||||
$status = Statuslabel::factory()->create();
|
||||
$field = CustomField::factory()->testEncrypted()->create();
|
||||
$superuser = User::factory()->superuser()->create();
|
||||
|
|
|
@ -10,18 +10,10 @@ use Tests\TestCase;
|
|||
|
||||
class AssetUpdateTest extends TestCase
|
||||
{
|
||||
// TODO - this 'helper' is duplicated in AssetStoreTest - we should extract it out if we can figure out how
|
||||
public function markIncompleteIfMySQL()
|
||||
{
|
||||
if (config('database.default') === 'mysql') {
|
||||
$this->markTestIncomplete('Custom Fields tests do not work on MySQL');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function testEncryptedCustomFieldCanBeUpdated()
|
||||
{
|
||||
$this->markIncompleteIfMySQL();
|
||||
$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');
|
||||
|
||||
$field = CustomField::factory()->testEncrypted()->create();
|
||||
$asset = Asset::factory()->hasEncryptedCustomField($field)->create();
|
||||
$superuser = User::factory()->superuser()->create();
|
||||
|
@ -39,7 +31,8 @@ class AssetUpdateTest extends TestCase
|
|||
|
||||
public function testPermissionNeededToUpdateEncryptedField()
|
||||
{
|
||||
$this->markIncompleteIfMySQL();
|
||||
$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');
|
||||
|
||||
$field = CustomField::factory()->testEncrypted()->create();
|
||||
$asset = Asset::factory()->hasEncryptedCustomField($field)->create();
|
||||
$normal_user = User::factory()->editAssets()->create();
|
||||
|
|
13
tests/Support/CanSkipTests.php
Normal file
13
tests/Support/CanSkipTests.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Support;
|
||||
|
||||
trait CanSkipTests
|
||||
{
|
||||
public function markIncompleteIfMySQL($message = 'Test skipped due to database driver being MySQL.')
|
||||
{
|
||||
if (config('database.default') === 'mysql') {
|
||||
$this->markTestIncomplete($message);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
|
|||
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
||||
use RuntimeException;
|
||||
use Tests\Support\AssertsAgainstSlackNotifications;
|
||||
use Tests\Support\CanSkipTests;
|
||||
use Tests\Support\CustomTestMacros;
|
||||
use Tests\Support\InteractsWithAuthentication;
|
||||
use Tests\Support\InitializesSettings;
|
||||
|
@ -14,6 +15,7 @@ use Tests\Support\InitializesSettings;
|
|||
abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
use AssertsAgainstSlackNotifications;
|
||||
use CanSkipTests;
|
||||
use CreatesApplication;
|
||||
use CustomTestMacros;
|
||||
use InteractsWithAuthentication;
|
||||
|
|
Loading…
Reference in a new issue