Skip redundant tests rather than expecting zero assertions
MODIFY
test/File/Crc32Test.php
test/File/Crc32Test.php
@@ -98,15 +98,15 @@ class Crc32Test extends TestCase
*/
public function testLegacy($options, $isValidParam, bool $expected, string $messageKey): void
{
- if (is_array($isValidParam)) {
+ if (! is_array($isValidParam)) {
+ $this->markTestSkipped('An array is expected for legacy compat tests');
+ }
+
$validator = new File\Crc32($options);
$this->assertEquals($expected, $validator->isValid($isValidParam['tmp_name'], $isValidParam));
if (! $expected) {
$this->assertArrayHasKey($messageKey, $validator->getMessages());
}
- } else {
- $this->expectNotToPerformAssertions();
- }
}
/**

MODIFY
test/File/ExcludeExtensionTest.php
test/File/ExcludeExtensionTest.php
@@ -94,15 +94,15 @@ class ExcludeExtensionTest extends TestCase
*/
public function testLegacy($options, $isValidParam, bool $expected, string $messageKey): void
{
- if (is_array($isValidParam)) {
+ if (! is_array($isValidParam)) {
+ $this->markTestSkipped('An array is expected for legacy compat tests');
+ }
+
$validator = new File\ExcludeExtension($options);
$this->assertEquals($expected, $validator->isValid($isValidParam['tmp_name'], $isValidParam));
if (! $expected) {
$this->assertArrayHasKey($messageKey, $validator->getMessages());
}
- } else {
- $this->expectNotToPerformAssertions();
- }
}
public function testCaseTesting(): void

MODIFY
test/File/ExistsTest.php
test/File/ExistsTest.php
@@ -75,12 +75,12 @@ class ExistsTest extends TestCase
*/
public function testLegacy(string $options, $isValidParam, bool $expected): void
{
- if (is_array($isValidParam)) {
+ if (! is_array($isValidParam)) {
+ $this->markTestSkipped('An array is expected for legacy compat tests');
+ }
+
$validator = new File\Exists($options);
$this->assertEquals($expected, $validator->isValid($isValidParam['tmp_name'], $isValidParam));
- } else {
- $this->expectNotToPerformAssertions();
- }
}
/**

MODIFY
test/File/ExtensionTest.php
test/File/ExtensionTest.php
@@ -95,15 +95,15 @@ class ExtensionTest extends TestCase
*/
public function testLegacy($options, $isValidParam, bool $expected, string $messageKey): void
{
- if (is_array($isValidParam)) {
+ if (! is_array($isValidParam)) {
+ $this->markTestSkipped('An array is expected for legacy compat tests');
+ }
+
$validator = new File\Extension($options);
$this->assertEquals($expected, $validator->isValid($isValidParam['tmp_name'], $isValidParam));
if (! $expected) {
$this->assertArrayHasKey($messageKey, $validator->getMessages());
}
- } else {
- $this->expectNotToPerformAssertions();
- }
}
/**

MODIFY
test/File/HashTest.php
test/File/HashTest.php
@@ -126,15 +126,15 @@ class HashTest extends TestCase
*/
public function testLegacy($options, $isValidParam, bool $expected, string $messageKey): void
{
- if (is_array($isValidParam)) {
+ if (! is_array($isValidParam)) {
+ $this->markTestSkipped('An array is expected for legacy compat tests');
+ }
+
$validator = new File\Hash($options);
$this->assertEquals($expected, $validator->isValid($isValidParam['tmp_name'], $isValidParam));
if (! $expected) {
$this->assertArrayHasKey($messageKey, $validator->getMessages());
}
- } else {
- $this->expectNotToPerformAssertions();
- }
}
/**

MODIFY
test/File/ImageSizeTest.php
test/File/ImageSizeTest.php
@@ -156,8 +156,10 @@ class ImageSizeTest extends TestCase
*/
public function testLegacy(array $options, $isValidParam, bool $expected, $messageKeys): void
{
- // Test legacy Laminas\Transfer API
- if (is_array($isValidParam)) {
+ if (! is_array($isValidParam)) {
+ $this->markTestSkipped('An array is expected for legacy compat tests');
+ }
+
$validator = new File\ImageSize($options);
$this->assertEquals($expected, $validator->isValid($isValidParam['tmp_name'], $isValidParam));
if (! $expected) {
@@ -168,9 +170,6 @@ class ImageSizeTest extends TestCase
$this->assertArrayHasKey($messageKey, $validator->getMessages());
}
}
- } else {
- $this->expectNotToPerformAssertions();
- }
}
/**

MODIFY
test/File/Md5Test.php
test/File/Md5Test.php
@@ -120,15 +120,15 @@ class Md5Test extends TestCase
*/
public function testLegacy($options, $isValidParam, bool $expected, string $messageKey): void
{
- if (is_array($isValidParam)) {
+ if (! is_array($isValidParam)) {
+ $this->markTestSkipped('An array is expected for legacy compat tests');
+ }
+
$validator = new File\Md5($options);
$this->assertEquals($expected, $validator->isValid($isValidParam['tmp_name'], $isValidParam));
if (! $expected) {
$this->assertArrayHasKey($messageKey, $validator->getMessages());
}
- } else {
- $this->expectNotToPerformAssertions();
- }
}
/**

MODIFY
test/File/NotExistsTest.php
test/File/NotExistsTest.php
@@ -76,12 +76,12 @@ class NotExistsTest extends TestCase
*/
public function testLegacy(string $options, $isValidParam, bool $expected): void
{
- if (is_array($isValidParam)) {
+ if (! is_array($isValidParam)) {
+ $this->markTestSkipped('An array is expected for legacy compat tests');
+ }
+
$validator = new File\NotExists($options);
$this->assertEquals($expected, $validator->isValid($isValidParam['tmp_name'], $isValidParam));
- } else {
- $this->expectNotToPerformAssertions();
- }
}
/**

MODIFY
test/File/Sha1Test.php
test/File/Sha1Test.php
@@ -103,15 +103,15 @@ class Sha1Test extends TestCase
*/
public function testLegacy($options, $isValidParam, bool $expected, string $messageKey): void
{
- if (is_array($isValidParam)) {
+ if (! is_array($isValidParam)) {
+ $this->markTestSkipped('An array is expected for legacy compat tests');
+ }
+
$validator = new File\Sha1($options);
$this->assertEquals($expected, $validator->isValid($isValidParam['tmp_name'], $isValidParam));
if (! $expected) {
$this->assertArrayHasKey($messageKey, $validator->getMessages());
}
- } else {
- $this->expectNotToPerformAssertions();
- }
}
/**

MODIFY
test/File/SizeTest.php
test/File/SizeTest.php
@@ -84,12 +84,12 @@ class SizeTest extends TestCase
*/
public function testLegacy($options, $isValidParam, bool $expected): void
{
- if (is_array($isValidParam)) {
+ if (! is_array($isValidParam)) {
+ $this->markTestSkipped('An array is expected for legacy compat tests');
+ }
+
$validator = new File\Size($options);
$this->assertEquals($expected, $validator->isValid($isValidParam['tmp_name'], $isValidParam));
- } else {
- $this->expectNotToPerformAssertions();
- }
}
/**

MODIFY
test/File/WordCountTest.php
test/File/WordCountTest.php
@@ -79,12 +79,12 @@ class WordCountTest extends TestCase
*/
public function testLegacy($options, $isValidParam, bool $expected): void
{
- if (is_array($isValidParam)) {
+ if (! is_array($isValidParam)) {
+ $this->markTestSkipped('An array is expected for legacy compat tests');
+ }
+
$validator = new File\WordCount($options);
$this->assertEquals($expected, $validator->isValid($isValidParam['tmp_name'], $isValidParam));
- } else {
- $this->expectNotToPerformAssertions();
- }
}
/**

Skip redundant tests rather than expecting zero assertions

Signed-off-by: George Steel <george@net-glue.co.uk>