Skip to content

Commit

Permalink
Temporarily log response to help troubleshooting CI
Browse files Browse the repository at this point in the history
  • Loading branch information
leonidasmi committed Nov 29, 2024
1 parent cf9a13d commit 90aa20b
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// @phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- This namespace should reflect the namespace of the original class.
namespace Yoast\WP\SEO\Tests\WP\Dashboard\User_Interface\Scores;

use Yoast\WP\SEO\Repositories\Indexable_Repository;
use Mockery;

Check failure on line 7 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

Use statements should be sorted alphabetically. The first wrong one is Mockery.
use WP_REST_Request;
use WP_REST_Response;
Expand Down Expand Up @@ -230,6 +231,7 @@ public function test_get_seo_scores( $inserted_posts, $taxonomy_filter, $expecte
$request->set_param( 'contentType', 'post' );

if ( ! empty( $taxonomy_filter ) ) {
error_log( print_r( $taxonomy_filter, true ) );

Check warning on line 234 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

error_log() found. Debug code should not normally be used in production.

Check warning on line 234 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

print_r() found. Debug code should not normally be used in production.

Check warning on line 234 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

error_log() found. Debug code should not normally be used in production.

Check failure on line 234 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

Function error_log() should be referenced via a fully qualified name.

Check warning on line 234 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

print_r() found. Debug code should not normally be used in production.

Check failure on line 234 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

Function print_r() should be referenced via a fully qualified name.
$request->set_param( 'taxonomy', 'category' );
$request->set_param( 'term', $taxonomy_filter['term_id'] );
}
Expand All @@ -242,20 +244,30 @@ public function test_get_seo_scores( $inserted_posts, $taxonomy_filter, $expecte

$this->factory()->post->create(
[
'post_title' => 'Test Post' . $key,
'post_title' => 'Test Post ' . $key,
'post_status' => 'publish',
'post_category' => [ $post['post_category'] ],
'meta_input' => $meta_input,
]
);
}

error_log(print_r(get_posts( [ 'post_type' => 'post', 'numberposts' => -1 ] ), true));

Check warning on line 255 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

error_log() found. Debug code should not normally be used in production.

Check warning on line 255 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

print_r() found. Debug code should not normally be used in production.

Check warning on line 255 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

error_log() found. Debug code should not normally be used in production.

Check failure on line 255 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

Function error_log() should be referenced via a fully qualified name.

Check failure on line 255 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

Expected 1 spaces after opening parenthesis; 0 found

Check warning on line 255 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

print_r() found. Debug code should not normally be used in production.

Check failure on line 255 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

Function print_r() should be referenced via a fully qualified name.

Check failure on line 255 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

Expected 1 spaces after opening parenthesis; 0 found

Check failure on line 255 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

Function get_posts() should be referenced via a fully qualified name.

Check failure on line 255 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

When a multi-item array uses associative keys, each value should start on a new line.

Check failure on line 255 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

Expected 1 spaces before closing parenthesis; 0 found
$post_indexables = YoastSEO()->classes->get( Indexable_Repository::class )->find_all_with_type_and_sub_type( 'post', 'post');

error_log('count: ' . count($post_indexables));

Check warning on line 258 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

error_log() found. Debug code should not normally be used in production.
foreach ( $post_indexables as $indexable ) {
error_log(print_r($indexable->object_id, true));

Check warning on line 260 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

error_log() found. Debug code should not normally be used in production.

Check warning on line 260 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

print_r() found. Debug code should not normally be used in production.
}

$response = \rest_get_server()->dispatch( $request );

$this->assertInstanceOf( WP_REST_Response::class, $response );

$response_data = $response->get_data();

error_log( print_r( $response_data, true ) );

Check warning on line 269 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

error_log() found. Debug code should not normally be used in production.

Check warning on line 269 in tests/WP/Dashboard/User_Interface/Scores/SEO_Scores_Route_Test.php

View workflow job for this annotation

GitHub Actions / Check code style

print_r() found. Debug code should not normally be used in production.

$this->assertIsArray( $response_data );
$this->assertIsArray( $response_data['scores'] );
$this->assertIsFloat( $response_data['queryTime'] );
Expand Down

0 comments on commit 90aa20b

Please sign in to comment.