Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

composer update + lint fix #54

Merged
merged 2 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ function skip_translations_api() {
require_once $_tests_dir . '/includes/functions.php';
require_once $_tests_dir . '/includes/bootstrap.php';
require_once __DIR__ . '/phpunit/BaseTestCase.php';
require_once __DIR__ . '/phpunit/factory/UserFactory.php';
require_once __DIR__ . '/phpunit/factory/UserFactory.php';
12 changes: 6 additions & 6 deletions tests/phpunit/feature/TestBooleanSearchOperators.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TestBooleanSearchOperators extends \WP_UnitTestCase {
*/
public function set_up() {
$instance = new ElasticPressLabs\Feature\BooleanSearchOperators();
\ElasticPress\Features::factory()->register_feature($instance);
\ElasticPress\Features::factory()->register_feature( $instance );
}

/**
Expand All @@ -44,8 +44,8 @@ protected function get_feature() {
public function testConstruct() {
$instance = $this->get_feature();

$this->assertEquals( 'boolean_search_operators', $instance->slug );
$this->assertEquals( 'Boolean Search Operators', $instance->title );
$this->assertEquals( 'boolean_search_operators', $instance->slug );
$this->assertEquals( 'Boolean Search Operators', $instance->title );
}

/**
Expand All @@ -56,7 +56,7 @@ public function testConstruct() {
public function testBoxSummary() {
ob_start();
$this->get_feature()->output_feature_box_summary();
$output = ob_get_clean();
$output = ob_get_clean();

$this->assertStringContainsString( 'Allow boolean operators in search queries', $output );
}
Expand All @@ -69,7 +69,7 @@ public function testBoxSummary() {
public function testBoxLong() {
ob_start();
$this->get_feature()->output_feature_box_long();
$output = ob_get_clean();
$output = ob_get_clean();

$this->assertStringContainsString( 'Allows users to search using the following boolean operators:', $output );
}
Expand All @@ -80,7 +80,7 @@ public function testBoxLong() {
* @since 1.2.0
*/
public function testQueryUsesBooleanOperators() {
$feature = $this->get_feature();
$feature = $this->get_feature();

$this->assertTrue( $feature->query_uses_boolean_operators( '(museum (art))' ) );
$this->assertTrue( $feature->query_uses_boolean_operators( '"american museum"' ) );
Expand Down
46 changes: 23 additions & 23 deletions tests/phpunit/feature/TestCoAuthorsPlus.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TestCoAuthorsPlus extends \WP_UnitTestCase {
*/
public function set_up() {
$instance = new ElasticPressLabs\Feature\CoAuthorsPlus();
\ElasticPress\Features::factory()->register_feature($instance);
\ElasticPress\Features::factory()->register_feature( $instance );
}

/**
Expand All @@ -40,13 +40,13 @@ protected function get_feature() {
* Get protected function as public
*
* @since 1.1.0
* @param string $functionName
* @param string $className
* @param string $function_name Function name
* @param string $class_name Class name
* @return ReflectionClass
*/
protected function get_protected_function( $functionName, $className = 'ElasticPressLabs\Feature\CoAuthorsPlus' ) {
$reflector = new \ReflectionClass( $className );
$function = $reflector->getMethod( $functionName );
protected function get_protected_function( $function_name, $class_name = 'ElasticPressLabs\Feature\CoAuthorsPlus' ) {
$reflector = new \ReflectionClass( $class_name );
$function = $reflector->getMethod( $function_name );
$function->setAccessible( true );

return $function;
Expand All @@ -60,8 +60,8 @@ protected function get_protected_function( $functionName, $className = 'ElasticP
public function testConstruct() {
$instance = $this->get_feature();

$this->assertEquals( 'co_authors_plus', $instance->slug );
$this->assertEquals( 'Co-Authors Plus', $instance->title );
$this->assertEquals( 'co_authors_plus', $instance->slug );
$this->assertEquals( 'Co-Authors Plus', $instance->title );
}

/**
Expand All @@ -72,7 +72,7 @@ public function testConstruct() {
public function testBoxSummary() {
ob_start();
$this->get_feature()->output_feature_box_summary();
$output = ob_get_clean();
$output = ob_get_clean();

$this->assertStringContainsString( 'Add support for the Co-Authors Plus plugin in the Admin Post List screen by Author name', $output );
}
Expand All @@ -85,7 +85,7 @@ public function testBoxSummary() {
public function testBoxLong() {
ob_start();
$this->get_feature()->output_feature_box_long();
$output = ob_get_clean();
$output = ob_get_clean();

$this->assertStringContainsString( 'If using the Co-Authors Plus plugin and the Protected Content feature, enable this feature to visit the Admin Post List screen by Author name <code>wp-admin/edit.php?author_name=&lt;name&gt;</code> and see correct results.', $output );
}
Expand All @@ -96,25 +96,25 @@ public function testBoxLong() {
* @since 1.1.0
*/
public function testFilterOutAuthorNameAndId() {
$feature = $this->get_feature();
$feature = $this->get_feature();
$function_filter_out_author_name_and_id_from_es_filter = $this->get_protected_function( 'filter_out_author_name_and_id_from_es_filter' );

$this->assertEquals([], $function_filter_out_author_name_and_id_from_es_filter->invokeArgs( $feature, array([])));
$this->assertEquals( [], $function_filter_out_author_name_and_id_from_es_filter->invokeArgs( $feature, array( [] ) ) );

$this->assertEquals('', $function_filter_out_author_name_and_id_from_es_filter->invokeArgs( $feature, array( '' ) ) );
$this->assertEquals( '', $function_filter_out_author_name_and_id_from_es_filter->invokeArgs( $feature, array( '' ) ) );

$formatted_args = [
'post_filter' => [
'bool' => [
'must' => [
[
'term' => [
'post_author.display_name' => [ 'test' ]
]
]
]
]
]
'post_author.display_name' => [ 'test' ],
],
],
],
],
],
];

$filtered_formatted_args = $function_filter_out_author_name_and_id_from_es_filter->invokeArgs( $feature, [ $formatted_args ] );
Expand All @@ -123,8 +123,8 @@ public function testFilterOutAuthorNameAndId() {

$formatted_args['post_filter']['bool']['must'][] = [
'terms' => [
'post_type.raw' => [ 'post' ]
]
'post_type.raw' => [ 'post' ],
],
];

$filtered_formatted_args = $function_filter_out_author_name_and_id_from_es_filter->invokeArgs( $feature, [ $formatted_args ] );
Expand All @@ -135,8 +135,8 @@ public function testFilterOutAuthorNameAndId() {

$formatted_args['post_filter']['bool']['must'][] = [
'term' => [
'post_author.id' => [ 1 ]
]
'post_author.id' => [ 1 ],
],
];

$filtered_formatted_args = $function_filter_out_author_name_and_id_from_es_filter->invokeArgs( $feature, [ $formatted_args ] );
Expand Down
Loading