Skip to content

Commit a4fd1b5

Browse files
committed
Cleanup unit tests
1 parent 713040d commit a4fd1b5

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

tests/CryptoEncoding/PEMBundleTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use LogicException;
88
use PHPUnit\Framework\Attributes\Depends;
9+
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
910
use PHPUnit\Framework\Attributes\Group;
1011
use PHPUnit\Framework\TestCase;
1112
use SimpleSAML\XMLSecurity\CryptoEncoding\PEM;
@@ -35,11 +36,10 @@ public static function setUpBeforeClass(): void
3536
/**
3637
* @return \SimpleSAML\XMLSecurity\CryptoEncoding\PEMBundle
3738
*/
39+
#[DoesNotPerformAssertions]
3840
public function testBundle(): PEMBundle
3941
{
40-
$bundle = PEMBundle::fromFile(self::$baseDir . '/resources/certificates/cacert.pem');
41-
$this->assertInstanceOf(PEMBundle::class, $bundle);
42-
return $bundle;
42+
return PEMBundle::fromFile(self::$baseDir . '/resources/certificates/cacert.pem');
4343
}
4444

4545

@@ -49,7 +49,6 @@ public function testBundle(): PEMBundle
4949
#[Depends('testBundle')]
5050
public function testAll(PEMBundle $bundle): void
5151
{
52-
// @phpstan-ignore method.alreadyNarrowedType
5352
$this->assertContainsOnlyInstancesOf(PEM::class, $bundle->all());
5453
}
5554

@@ -60,7 +59,6 @@ public function testAll(PEMBundle $bundle): void
6059
#[Depends('testBundle')]
6160
public function testFirst(PEMBundle $bundle): void
6261
{
63-
$this->assertInstanceOf(PEM::class, $bundle->first());
6462
$this->assertEquals($bundle->all()[0], $bundle->first());
6563
}
6664

@@ -71,7 +69,6 @@ public function testFirst(PEMBundle $bundle): void
7169
#[Depends('testBundle')]
7270
public function testLast(PEMBundle $bundle): void
7371
{
74-
$this->assertInstanceOf(PEM::class, $bundle->last());
7572
$this->assertEquals($bundle->all()[149], $bundle->last());
7673
}
7774

@@ -96,7 +93,6 @@ public function testIterator(PEMBundle $bundle): void
9693
foreach ($bundle as $pem) {
9794
$values[] = $pem;
9895
}
99-
// @phpstan-ignore method.alreadyNarrowedType
10096
$this->assertContainsOnlyInstancesOf(PEM::class, $values);
10197
}
10298

tests/CryptoEncoding/PEMTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace SimpleSAML\XMLSecurity\Test\CryptoEncoding;
66

77
use PHPUnit\Framework\Attributes\Depends;
8+
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
89
use PHPUnit\Framework\Attributes\Group;
910
use PHPUnit\Framework\TestCase;
1011
use RuntimeException;
@@ -32,22 +33,21 @@ public static function setUpBeforeClass(): void
3233
}
3334

3435

36+
#[DoesNotPerformAssertions]
3537
public function testFromString(): void
3638
{
3739
$str = file_get_contents(self::$baseDir . '/resources/keys/pubkey.pem');
38-
$pem = PEM::fromString($str);
39-
$this->assertInstanceOf(PEM::class, $pem);
40+
PEM::fromString($str);
4041
}
4142

4243

4344
/**
4445
* @return \SimpleSAML\XMLSecurity\CryptoEncoding\PEM
4546
*/
47+
#[DoesNotPerformAssertions]
4648
public function testFromFile(): PEM
4749
{
48-
$pem = PEM::fromFile(self::$baseDir . '/resources/keys/pubkey.pem');
49-
$this->assertInstanceOf(PEM::class, $pem);
50-
return $pem;
50+
return PEM::fromFile(self::$baseDir . '/resources/keys/pubkey.pem');
5151
}
5252

5353

0 commit comments

Comments
 (0)