Skip to content

Commit

Permalink
Migrate phpunit metadata to attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Mar 19, 2024
1 parent de6b335 commit 0d42fdd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
25 changes: 9 additions & 16 deletions tests/CryptoEncoding/PEMBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace SimpleSAML\XMLSecurity\Test\CryptoEncoding;

use LogicException;
use PHPUnit\Framework\Attributes\Depends;
use PHPUnit\Framework\TestCase;
use SimpleSAML\XMLSecurity\CryptoEncoding\PEM;
use SimpleSAML\XMLSecurity\CryptoEncoding\PEMBundle;
Expand Down Expand Up @@ -43,21 +44,19 @@ public function testBundle(): PEMBundle


/**
* @depends testBundle
*
* @param \SimpleSAML\XMLSecurity\CryptoEncoding\PEMBundle $bundle
*/
#[Depends('testBundle')]
public function testAll(PEMBundle $bundle): void
{
$this->assertContainsOnlyInstancesOf(PEM::class, $bundle->all());
}


/**
* @depends testBundle
*
* @param \SimpleSAML\XMLSecurity\CryptoEncoding\PEMBundle $bundle
*/
#[Depends('testBundle')]
public function testFirst(PEMBundle $bundle): void
{
$this->assertInstanceOf(PEM::class, $bundle->first());
Expand All @@ -66,10 +65,9 @@ public function testFirst(PEMBundle $bundle): void


/**
* @depends testBundle
*
* @param \SimpleSAML\XMLSecurity\CryptoEncoding\PEMBundle $bundle
*/
#[Depends('testBundle')]
public function testLast(PEMBundle $bundle): void
{
$this->assertInstanceOf(PEM::class, $bundle->last());
Expand All @@ -78,21 +76,19 @@ public function testLast(PEMBundle $bundle): void


/**
* @depends testBundle
*
* @param \SimpleSAML\XMLSecurity\CryptoEncoding\PEMBundle $bundle
*/
#[Depends('testBundle')]
public function testCount(PEMBundle $bundle): void
{
$this->assertCount(150, $bundle);
}


/**
* @depends testBundle
*
* @param \SimpleSAML\XMLSecurity\CryptoEncoding\PEMBundle $bundle
*/
#[Depends('testBundle')]
public function testIterator(PEMBundle $bundle): void
{
$values = [];
Expand All @@ -104,21 +100,19 @@ public function testIterator(PEMBundle $bundle): void


/**
* @depends testBundle
*
* @param \SimpleSAML\XMLSecurity\CryptoEncoding\PEMBundle $bundle
*/
#[Depends('testBundle')]
public function testString(PEMBundle $bundle): void
{
$this->assertIsString($bundle->string());
}


/**
* @depends testBundle
*
* @param \SimpleSAML\XMLSecurity\CryptoEncoding\PEMBundle $bundle
*/
#[Depends('testBundle')]
public function testToString(PEMBundle $bundle): void
{
$this->assertIsString(strval($bundle));
Expand Down Expand Up @@ -168,10 +162,9 @@ public function testLastEmptyFail(): void


/**
* @depends testBundle
*
* @param \SimpleSAML\XMLSecurity\CryptoEncoding\PEMBundle $bundle
*/
#[Depends('testBundle')]
public function testWithPEMs(PEMBundle $bundle): void
{
$bundle = $bundle->withPEMs(new PEM('TEST', 'data'));
Expand Down
10 changes: 4 additions & 6 deletions tests/CryptoEncoding/PEMTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace SimpleSAML\XMLSecurity\Test\CryptoEncoding;

use PHPUnit\Framework\Attributes\Depends;
use PHPUnit\Framework\TestCase;
use RuntimeException;
use SimpleSAML\XMLSecurity\CryptoEncoding\PEM;
Expand Down Expand Up @@ -51,10 +52,9 @@ public function testFromFile(): PEM


/**
* @depends testFromFile
*
* @param \SimpleSAML\XMLSecurity\CryptoEncoding\PEM $pem
*/
#[Depends('testFromFile')]
public function testType(PEM $pem): void
{
$this->assertEquals(PEM::TYPE_PUBLIC_KEY, $pem->type());
Expand Down Expand Up @@ -101,21 +101,19 @@ public function testInvalidFile(): void


/**
* @depends testFromFile
*
* @param \SimpleSAML\XMLSecurity\CryptoEncoding\PEM $pem
*/
#[Depends('testFromFile')]
public function testString(PEM $pem): void
{
$this->assertIsString($pem->string());
}


/**
* @depends testFromFile
*
* @param \SimpleSAML\XMLSecurity\CryptoEncoding\PEM $pem
*/
#[Depends('testFromFile')]
public function testToString(PEM $pem): void
{
$this->assertIsString(strval($pem));
Expand Down

0 comments on commit 0d42fdd

Please sign in to comment.