Skip to content

Commit

Permalink
Coding standards.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbillion committed Sep 8, 2024
1 parent 39a7667 commit 003a00e
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions tests/phpunit/HooksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use PHPUnit\Framework\TestCase;
use WPHooks\Hook;
use WPHooks\Hooks;
use WPHooks\Tag;

final class HooksTest extends TestCase {
/**
Expand Down Expand Up @@ -53,6 +52,8 @@ public function testCanGetReturnTypes(): void {
$hooks = $this->getFilters();
$hook = $hooks->find( 'wp_tag_cloud' );

self::assertInstanceOf( Hook::class, $hook );

$returnTypes = $hook->getDoc()->getReturnTypes();
$expected = [
'string',
Expand All @@ -66,6 +67,8 @@ public function testCanGetReturnTypeString(): void {
$hooks = $this->getFilters();
$hook = $hooks->find( 'wp_tag_cloud' );

self::assertInstanceOf( Hook::class, $hook );

$returnType = $hook->getDoc()->getReturnTypeString();

self::assertSame( 'string|string[]', $returnType );
Expand All @@ -75,17 +78,19 @@ public function testCanGetParams(): void {
$hooks = $this->getFilters();
$hook = $hooks->find( 'wp_tag_cloud' );

self::assertInstanceOf( Hook::class, $hook );

$params = $hook->getDoc()->getParams();

self::assertCount( 2, $params );
self::assertInstanceOf( Tag::class, $params[0] );
self::assertInstanceOf( Tag::class, $params[1] );
}

public function testCanCountParams(): void {
$hooks = $this->getFilters();
$hook = $hooks->find( 'wp_tag_cloud' );

self::assertInstanceOf( Hook::class, $hook );

$count = $hook->getDoc()->countParams();

self::assertSame( 2, $count );
Expand All @@ -95,6 +100,8 @@ public function testCanGetSince(): void {
$hooks = $this->getFilters();
$hook = $hooks->find( 'wp_tag_cloud' );

self::assertInstanceOf( Hook::class, $hook );

$since = $hook->getDoc()->getSince();

self::assertSame( '2.3.0', $since );
Expand Down Expand Up @@ -148,7 +155,7 @@ private function getFilters(): Hooks {
return Hooks::fromFile( $this->dataCoreFiles()['filters'][0] );
}

private function getActions(): Hooks {
return Hooks::fromFile( $this->dataCoreFiles()['actions'][0] );
}
// private function getActions(): Hooks {
// return Hooks::fromFile( $this->dataCoreFiles()['actions'][0] );
// }
}

0 comments on commit 003a00e

Please sign in to comment.