Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/test cleanup #271

Merged
merged 4 commits into from
Jul 30, 2024
Merged

Feature/test cleanup #271

merged 4 commits into from
Jul 30, 2024

Conversation

jason-jackson
Copy link
Contributor

Changed

  • Fix announcement tests
  • Add description of all metadata tests to README
  • Cleanup metadata tests to use corresponding assert

@jason-jackson jason-jackson requested a review from a team July 23, 2024 15:51
}

$idpFiles = $this->getIdPMetadataFiles();
foreach ($idpFiles as $file) {
$returnVal = include $file;
$this->assertTrue(is_array($returnVal), 'Metadata file does not return array as expected. File: ' . $file);
$this->assertIsArray($returnVal, 'Metadata file does not return array as expected. File: ' . $file);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look at the assertions for PHPUnit, you'll notice they are static. Have the same clean up mess in MailAdmin to deal with.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assertion methods are declared static and can be invoked from any context using PHPUnit\Framework\Assert::assertTrue(), for instance, or using $this->assertTrue() or self::assertTrue(), for instance, in a class that extends PHPUnit\Framework\TestCase. You can even use global function wrappers such as assertTrue().

https://docs.phpunit.de/en/11.2/assertions.html#static-vs-non-static-usage-of-assertion-methods

We use class AnnouncementTest extends TestCase , so it is fine as it is.

Copy link

@mtompset mtompset left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup of lazy assertTrue's and assertFalse's to more proper assertions. Though, explain that one change before merging, please.

@briskt briskt self-requested a review July 26, 2024 02:09
Copy link

sonarcloud bot commented Jul 26, 2024

@jason-jackson jason-jackson merged commit a3b643c into develop Jul 30, 2024
3 checks passed
@jason-jackson jason-jackson deleted the feature/test-cleanup branch July 30, 2024 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants