-
Notifications
You must be signed in to change notification settings - Fork 2
Test case for AMP_AdManager class #71
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
Conversation
rtBot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
phpcs scanning turned up:
🚫 17 errors
hashes-api-scanning skipped
Posting will continue in further review(s)
| /** | ||
| * This function sets the instance for class \AMP_AdManager\Shortcode. | ||
| */ | ||
| public function setUp(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: void return type is not present in PHP version 7.0 or earlier (PHPCompatibility.FunctionDeclarations.NewReturnTypeDeclarations.voidFound).
rtBot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previous scan continued.
| * | ||
| * @var AMP_AdManager | ||
| */ | ||
| protected $_instance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| call_user_func( | ||
| sprintf( 'has_%s', $hook['type'] ), | ||
| $hook['name'], | ||
| array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use [] array syntax here
| * @param array $args WP query arguments. | ||
| * @param array $conditions wp query conditions. | ||
| */ | ||
| public function mock_wp_query( $args, $conditions ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this method to Utility class so it can be reused wherever needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
|
|
||
| // Update settings after updating option. | ||
| AMP_AdManager::$amp_settings = get_option( 'amp-admanager-menu-settings' ); | ||
| $output = Utility::buffer_and_return( array( $this->_instance, 'load_amp_resources' ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use [] array syntax
| ) ); | ||
| update_option( | ||
| 'amp-admanager-menu-settings', | ||
| array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use [] syntax here
| $user_mock = $this->factory->user->create_and_get( [ 'role' => 'administrator' ] ); | ||
| wp_set_current_user( $user_mock->ID ); | ||
| $_GET['amp_validate'] = true; | ||
| $output_user = Utility::buffer_and_return( array( $this->_instance, 'load_amp_resources' ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use [] array syntax
|
@vaishaliagola27 The AMP admanager class has some missing code coverage can you please fix it or ignore it with valid comments if it cannot be covered. |
rtBot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
phpcs scanning turned up:
🚫 3 errors
hashes-api-scanning skipped
deepaklalwani97
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Add test case for AMP_AdManager class
Covers point 3 in #60 (comment)