-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes#4830 Rankmath class not found (#6695)
- Loading branch information
Showing
7 changed files
with
94 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
tests/Integration/inc/ThirdParty/Plugins/SEO/RankMathSEO/addSitemap.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace WP_Rocket\Tests\Integration\inc\ThirdParty\Plugins\SEO\RankMathSEO; | ||
|
||
use RankMath\Sitemap\Router; | ||
use WP_Rocket\Tests\Integration\TestCase; | ||
|
||
/** | ||
* Test class covering \WP_Rocket\ThirdParty\Plugins\SEO\RankMathSEO::add_sitemap | ||
* | ||
* @group RankMathSEO | ||
* @group ThirdParty | ||
*/ | ||
class TestRocketSitemap extends TestCase { | ||
public function set_up() { | ||
parent::set_up(); | ||
|
||
$this->unregisterAllCallbacksExcept( 'rocket_sitemap_preload_list', 'add_sitemap', 15 ); | ||
} | ||
|
||
public function tear_down() { | ||
$this->restoreWpHook( 'rocket_sitemap_preload_list' ); | ||
|
||
parent::tear_down(); | ||
} | ||
|
||
/** | ||
* @dataProvider configTestData | ||
*/ | ||
public function testShouldReturnExpected( $config, $expected ) { | ||
Router::$sitemap = $config['sitemap']; | ||
|
||
$this->assertSame( | ||
$expected, | ||
apply_filters( 'rocket_sitemap_preload_list', $config['sitemaps'] ) | ||
); | ||
} | ||
} |
39 changes: 0 additions & 39 deletions
39
tests/Integration/inc/ThirdParty/Plugins/SEO/RankMathSEO/rocketSitemap.php
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
tests/Unit/inc/ThirdParty/Plugins/SEO/RankMathSEO/addSitemap.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace WP_Rocket\Tests\Unit\inc\ThirdParty\Plugins\SEO\RankMathSEO; | ||
|
||
use RankMath\Sitemap\Router; | ||
use WP_Rocket\Tests\Unit\TestCase; | ||
use WP_Rocket\ThirdParty\Plugins\SEO\RankMathSEO; | ||
|
||
/** | ||
* Test class covering \WP_Rocket\ThirdParty\Plugins\SEO\RankMathSEO::add_sitemap | ||
* | ||
* @group RankMathSEO | ||
* @group ThirdParty | ||
*/ | ||
class Test_RocketSitemap extends TestCase { | ||
protected $option; | ||
protected $subscriber; | ||
|
||
protected function setUp(): void { | ||
parent::setUp(); | ||
|
||
$this->subscriber = new RankMathSEO(); | ||
} | ||
|
||
/** | ||
* @dataProvider configTestData | ||
*/ | ||
public function testShouldReturnAsExpected( $config, $expected ) { | ||
Router::$sitemap = $config['sitemap']; | ||
|
||
$this->assertSame( | ||
$expected, | ||
$this->subscriber->add_sitemap( $config['sitemaps'] ) | ||
); | ||
} | ||
} |
36 changes: 0 additions & 36 deletions
36
tests/Unit/inc/ThirdParty/Plugins/SEO/RankMathSEO/rocketSitemap.php
This file was deleted.
Oops, something went wrong.