Skip to content

Commit

Permalink
Merge branch 'develop' into fix/integration-tests-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Tabrisrp committed May 9, 2024
2 parents 0685e57 + 770c397 commit 66346fc
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 168 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

return [
'testShouldReturnTrueWhenNotObject' => [
'data' => [],
'expected' => true,
],
'testShouldReturnTrueWhenPropertyNotSet' => [
'data' => json_decode( json_encode( [
'ID' => 1,
] ) ),
'expected' => true,
],
'testShouldReturnFalseWhenNotExpired' => [
'data' => json_decode( json_encode( [
'ID' => 1,
'licence_expiration' => strtotime( 'next week' ),
] ) ),
'expected' => false,
],
'testShouldReturnTrueWhenExpired' => [
'data' => json_decode( json_encode( [
'ID' => 1,
'licence_expiration' => strtotime( '3 weeks ago' ),
] ) ),
'expected' => true,
],
];

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,41 @@

use WP_Rocket\Engine\Preload\Database\Queries\Cache;
use WP_Rocket\Tests\Unit\TestCase;
use Brain\Monkey\Filters;

class Test_GetOutdatedInProgressJobs extends TestCase
{
/**
* Test class covering Cache::get_outdated_in_progress_jobs
*
* @group Preload
*/
class Test_GetOutdatedInProgressJobs extends TestCase {
protected $query;

protected function setUp(): void
{
protected function setUp(): void {
parent::setUp();
$this->query = $this->createPartialMock(Cache::class, ['get_rows_by_url', 'query']);

$this->query = $this->createPartialMock( Cache::class, [ 'get_rows_by_url', 'query' ] );
}

/**
* @dataProvider configTestData
*/
public function testShouldReturnAsExpected($config, $expected) {
$this->query->expects($this->at(0))->method('query')->with( [
'status' => 'in-progress',
'is_locked' => false,
'date_query' => [
[
'column' => 'modified',
'before' => '3 minute ago',
public function testShouldReturnAsExpected( $config, $expected ) {
$this->query->method( 'query' )->with(
[
'status' => 'in-progress',
'is_locked' => false,
'date_query' => [
[
'column' => 'modified',
'before' => '3 minute ago',
],
],
],
] )->willReturn( $config['results'] );

]
)->willReturn( $config['results'] );

$this->assertSame($expected, $this->query->get_outdated_in_progress_jobs());
$this->assertSame(
$expected,
$this->query->get_outdated_in_progress_jobs()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

/**
* Test class covering \WP_Rocket\Engine\Preload\Database\Queries\Cache::make_status_complete
* @uses \WP_Rocket\Engine\Preload\Database\Queries\CacheRow
*
* @group Database
* @group Preload
Expand Down
75 changes: 0 additions & 75 deletions tests/Unit/inc/Engine/Preload/Subscriber/excludePrivatePostUri.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

/**
* Test class covering \WP_Rocket\ThirdParty\Themes\Divi::add_divi_to_description
* @uses \WP_Rocket\ThirdParty\Themes\Divi::is_divi
*
* @group ThirdParty
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
use Brain\Monkey\Functions;
use WP_Rocket\ThirdParty\Themes\Divi;
use WP_Theme;
use Brain\Monkey\Filters;

/**
* Test class covering \WP_Rocket\ThirdParty\Themes\Divi::disable_divi_jquery_body
* @uses \WP_Rocket\ThirdParty\Themes\Divi::is_divi
*
* @group ThirdParty
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

/**
* Test class covering \WP_Rocket\ThirdParty\Themes\Divi::disable_image_dimensions_height_percentage
* @uses \WP_Rocket\ThirdParty\Themes\Divi::is_divi
*
* @group ThirdParty
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

/**
* Test class covering \WP_Rocket\ThirdParty\Themes\Divi::remove_assets_generated
* @uses \WP_Rocket\ThirdParty\Themes\Divi::is_divi
*
* @group ThirdParty
*/
Expand Down
1 change: 0 additions & 1 deletion tests/Unit/inc/common/rocketGetPurgeUrls.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public function setUp() : void {
* @dataProvider providerTestData
*/
public function testShouldReturnUrls( $config, $expected ) {
$this->markTestSkipped('Error with require');
$post_id = isset( $config['post_data']['ID'] ) ? $config['post_data']['ID'] : 0;
$post = isset( $config['post_data'] ) ? (object) $config['post_data'] : null;
$options = isset( $config['options'] ) ? $config['options'] : [];
Expand Down

0 comments on commit 66346fc

Please sign in to comment.