diff --git a/tests/Feature/Api/Assets/AssetStoreTest.php b/tests/Feature/Api/Assets/AssetStoreTest.php index 5f143904d5..c874745510 100644 --- a/tests/Feature/Api/Assets/AssetStoreTest.php +++ b/tests/Feature/Api/Assets/AssetStoreTest.php @@ -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(); diff --git a/tests/Feature/Api/Assets/AssetUpdateTest.php b/tests/Feature/Api/Assets/AssetUpdateTest.php index 80e302aeed..ed830c379c 100644 --- a/tests/Feature/Api/Assets/AssetUpdateTest.php +++ b/tests/Feature/Api/Assets/AssetUpdateTest.php @@ -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(); diff --git a/tests/Support/CanSkipTests.php b/tests/Support/CanSkipTests.php new file mode 100644 index 0000000000..2a1eec10fc --- /dev/null +++ b/tests/Support/CanSkipTests.php @@ -0,0 +1,13 @@ +markTestIncomplete($message); + } + } +} diff --git a/tests/TestCase.php b/tests/TestCase.php index 0c5ecc37e8..dfff2427af 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -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;