Skip to content

Commit

Permalink
tests: fix namespaces for Codeception tests (#106)
Browse files Browse the repository at this point in the history
* tests: fix namespaces

* tests: namespaces for functional tests
  • Loading branch information
justlevine authored Aug 11, 2024
1 parent 52d053e commit 79b685c
Show file tree
Hide file tree
Showing 20 changed files with 43 additions and 17 deletions.
1 change: 1 addition & 0 deletions codeception.dist.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
namespace: Tests\WPGraphQL\RankMath
paths:
tests: '%TESTS_DIR%'
output: '%TESTS_OUTPUT%'
Expand Down
1 change: 1 addition & 0 deletions tests/_support/AcceptanceTester.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

namespace Tests\WPGraphQL\RankMath;

/**
* Inherited Methods
Expand Down
1 change: 1 addition & 0 deletions tests/_support/FunctionalTester.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

namespace Tests\WPGraphQL\RankMath;

/**
* Inherited Methods
Expand Down
3 changes: 2 additions & 1 deletion tests/_support/Helper/Acceptance.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace Helper;

namespace Tests\WPGraphQL\RankMath\Helper;

// here you can define custom actions
// all public methods declared in helper class will be available in $I
Expand Down
3 changes: 2 additions & 1 deletion tests/_support/Helper/Functional.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace Helper;

namespace Tests\WPGraphQL\RankMath\Helper;

// here you can define custom actions
// all public methods declared in helper class will be available in $I
Expand Down
3 changes: 2 additions & 1 deletion tests/_support/Helper/Unit.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace Helper;

namespace Tests\WPGraphQL\RankMath\Helper;

// here you can define custom actions
// all public methods declared in helper class will be available in $I
Expand Down
3 changes: 2 additions & 1 deletion tests/_support/Helper/Wpunit.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace Helper;

namespace Tests\WPGraphQL\RankMath\Helper;

// here you can define custom actions
// all public methods declared in helper class will be available in $I
Expand Down
1 change: 1 addition & 0 deletions tests/_support/UnitTester.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

namespace Tests\WPGraphQL\RankMath;

/**
* Inherited Methods
Expand Down
1 change: 1 addition & 0 deletions tests/_support/WpunitTester.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

namespace Tests\WPGraphQL\RankMath;

/**
* Inherited Methods
Expand Down
2 changes: 2 additions & 0 deletions tests/functional/ContentNodeSeoQueryCept.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Tests\WPGraphQL\RankMath;

$I = new FunctionalTester( $scenario );
$I->wantTo( 'Query content node seo data' );

Expand Down
2 changes: 2 additions & 0 deletions tests/functional/ContentTypeSeoQueryCept.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Tests\WPGraphQL\RankMath;

$I = new FunctionalTester( $scenario );
$I->wantTo( 'Query content type seo data' );

Expand Down
2 changes: 2 additions & 0 deletions tests/functional/TermNodeSeoQueryCept.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Tests\WPGraphQL\RankMath;

$I = new FunctionalTester( $scenario );
$I->wantTo( 'Query content node seo data' );

Expand Down
3 changes: 3 additions & 0 deletions tests/functional/UserSeoQueryCept.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

namespace Tests\WPGraphQL\RankMath;


$I = new FunctionalTester( $scenario );
$I->wantTo( 'Query content node seo data' );

Expand Down
2 changes: 1 addition & 1 deletion tests/unit.suite.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ class_name: UnitTester
modules:
enabled:
- Asserts
- \Helper\Unit
- \Tests\WPGraphQL\RankMath\Helper\Unit
2 changes: 1 addition & 1 deletion tests/wpunit.suite.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ actor: WpunitTester
modules:
enabled:
- WPLoader
- \Helper\Wpunit
- \Tests\WPGraphQL\RankMath\Helper\Wpunit
disabled:
- WPDb
- WPBrowser
Expand Down
5 changes: 4 additions & 1 deletion tests/wpunit/ContentNodeSeoQueryTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?php

namespace Tests\WPGraphQL\RankMath;

/**
* Tests ContentNode seo queries.
*/
class ContentNodeSeoQueryTest extends \Tests\WPGraphQL\TestCase\WPGraphQLTestCase {
public $admin;
public $database_id;
public \WpunitTester $tester;
protected WpunitTester $tester;

/**
* {@inheritDoc}
Expand Down
2 changes: 1 addition & 1 deletion tests/wpunit/MainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testInstanceBeforeInstantiation() {
*/
public function testClone() {
$actual = Main::instance();
$rc = new ReflectionClass( $actual );
$rc = new \ReflectionClass( $actual );
$this->assertTrue( $rc->hasMethod( '__clone' ) );
$this->assertTrue( $rc->hasMethod( '__wakeup' ) );
}
Expand Down
9 changes: 4 additions & 5 deletions tests/wpunit/RedirectionConnectionQueriesTest.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<?php

namespace Tests\WPGraphQL\RankMath;

use RankMath\Helper;
use RankMath\Redirections\DB;
use WPGraphQL\RankMath\Modules\Redirection\CoreSchemaFilters;
use WPGraphQL\RankMath\Modules\Redirection\Type\Enum\RedirectionComparisonTypeEnum;
use WPGraphQL\RankMath\Modules\Redirection\Type\Enum\RedirectionStatusEnum;
use WPGraphQL\RankMath\Modules\Redirection\Type\Enum\RedirectionTypeEnum;
use WPGraphQL\RankMath\Modules\Redirection\TypeRegistry;
use WPGraphQL\RankMath\TypeRegistry as ParentTypeRegistry;

class RedirectionConnectionQueriesTest extends \Tests\WPGraphQL\TestCase\WPGraphQLTestCase {
protected \WpunitTester $tester;
protected WpunitTester $tester;
public $admin;
public $database_ids;

Expand All @@ -27,7 +26,7 @@ public function setUp(): void {
Helper::update_modules( [ 'redirections' => 'on' ] );

// Unset the default type registry
$registry = new ReflectionProperty( ParentTypeRegistry::class, 'registry' );
$registry = new \ReflectionProperty( ParentTypeRegistry::class, 'registry' );
$registry->setAccessible( true );
$registry->setValue( null, [] );

Expand Down
7 changes: 5 additions & 2 deletions tests/wpunit/RedirectionQueriesTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Tests\WPGraphQL\RankMath;

use RankMath\Helper;
use RankMath\Redirections\DB;
use WPGraphQL\RankMath\Modules\Redirection\CoreSchemaFilters;
Expand All @@ -10,7 +12,8 @@
use WPGraphQL\RankMath\TypeRegistry as ParentTypeRegistry;

class RedirectionQueriesTest extends \Tests\WPGraphQL\TestCase\WPGraphQLTestCase {
protected \WpunitTester $tester;
protected WpunitTester $tester;

public $admin;

public function setUp(): void {
Expand All @@ -26,7 +29,7 @@ public function setUp(): void {
Helper::update_modules( [ 'redirections' => 'on' ] );

// Unset the default type registry
$registry = new ReflectionProperty( ParentTypeRegistry::class, 'registry' );
$registry = new \ReflectionProperty( ParentTypeRegistry::class, 'registry' );
$registry->setAccessible( true );
$registry->setValue( null, [] );

Expand Down
7 changes: 5 additions & 2 deletions tests/wpunit/SettingsRedirectionQueriesTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<?php

namespace Tests\WPGraphQL\RankMath;

use RankMath\Helper;
use WPGraphQL\RankMath\Modules\Redirection\Type\Enum\RedirectionBehaviorEnum;
use WPGraphQL\RankMath\Modules\Redirection\Type\Enum\RedirectionTypeEnum;
use WPGraphQL\RankMath\Modules\Redirection\TypeRegistry;
use WPGraphQL\RankMath\TypeRegistry as ParentTypeRegistry;

class SettingsRedirectionQueriesTest extends \Tests\WPGraphQL\TestCase\WPGraphQLTestCase {
protected \WpunitTester $tester;
protected WpunitTester $tester;

public $admin;


Expand All @@ -22,7 +25,7 @@ public function setUp(): void {
Helper::update_modules( [ 'redirections' => 'on' ] );

// Unset the default type registry
$registry = new ReflectionProperty( ParentTypeRegistry::class, 'registry' );
$registry = new \ReflectionProperty( ParentTypeRegistry::class, 'registry' );
$registry->setAccessible( true );
$registry->setValue( null, [] );

Expand Down

0 comments on commit 79b685c

Please sign in to comment.