Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Adds Unit Test#49

Open
vaishaliagola27 wants to merge 44 commits intodevelopfrom
dev-unit-test
Open

Adds Unit Test#49
vaishaliagola27 wants to merge 44 commits intodevelopfrom
dev-unit-test

Conversation

@vaishaliagola27
Copy link
Collaborator

@vaishaliagola27 vaishaliagola27 commented Feb 21, 2020

Copy link
Contributor

@rtBot rtBot left a 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:

🚫 13 errors

⚠️ 4 warnings


hashes-api-scanning skipped

Posting will continue in further review(s)

@@ -0,0 +1,20 @@
<?php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: The "blank-theme" prefix is not a valid namespace/function/class/variable/constant prefix in PHP (WordPress.NamingConventions.PrefixAllGlobals.InvalidPrefixPassed).

});
add_filter( 'pre_option_stylesheet', function() use ( $current_theme ) {
return $current_theme;
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Closing parenthesis of a multi-line function call must be on a line by itself (PEAR.Functions.FunctionCallSignature.CloseBracketLine).

add_filter( 'pre_option_template', function() use ( $current_theme ) {
return $current_theme;
});
add_filter( 'pre_option_stylesheet', function() use ( $current_theme ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Only one argument is allowed per line in a multi-line function call (PEAR.Functions.FunctionCallSignature.MultipleArguments).

add_filter( 'pre_option_template', function() use ( $current_theme ) {
return $current_theme;
});
add_filter( 'pre_option_stylesheet', function() use ( $current_theme ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Opening parenthesis of a multi-line function call must be the last content on the line (PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket).


add_filter( 'pre_option_template', function() use ( $current_theme ) {
return $current_theme;
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Closing parenthesis of a multi-line function call must be on a line by itself (PEAR.Functions.FunctionCallSignature.CloseBracketLine).


register_theme_directory( $theme_root );

add_filter( 'pre_option_template', function() use ( $current_theme ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Only one argument is allowed per line in a multi-line function call (PEAR.Functions.FunctionCallSignature.MultipleArguments).


register_theme_directory( $theme_root );

add_filter( 'pre_option_template', function() use ( $current_theme ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Opening parenthesis of a multi-line function call must be the last content on the line (PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket).


add_filter( 'theme_root', function() use ( $theme_root ) {
return $theme_root;
} );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Closing parenthesis of a multi-line function call must be on a line by itself (PEAR.Functions.FunctionCallSignature.CloseBracketLine).

$current_theme = basename( $theme_dir );
$theme_root = dirname( $theme_dir );

add_filter( 'theme_root', function() use ( $theme_root ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Only one argument is allowed per line in a multi-line function call (PEAR.Functions.FunctionCallSignature.MultipleArguments).

$current_theme = basename( $theme_dir );
$theme_root = dirname( $theme_dir );

add_filter( 'theme_root', function() use ( $theme_root ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Opening parenthesis of a multi-line function call must be the last content on the line (PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket).

Copy link
Contributor

@rtBot rtBot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous scan continued.


$theme_dir = dirname( __DIR__ );
$current_theme = basename( $theme_dir );
$theme_root = dirname( $theme_dir );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space (Generic.Formatting.MultipleStatementAlignment.NotSameWarning).

*/
function _register_theme() {

$theme_dir = dirname( __DIR__ );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space (Generic.Formatting.MultipleStatementAlignment.NotSameWarning).

/**
* Registers theme
*/
function _register_theme() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Functions declared in the global namespace by a theme/plugin should start with the theme/plugin prefix. Found: "_register_theme" (WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound).

}

if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) {
echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '"Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?"' (WordPress.Security.EscapeOutput.OutputNotEscaped).

$_tests_dir = getenv( 'WP_TESTS_DIR' );

if ( ! $_tests_dir ) {
$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: "$_tests_dir" (WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound).

* @package Blank_Theme
*/

$_tests_dir = getenv( 'WP_TESTS_DIR' );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: "$_tests_dir" (WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound).

@@ -0,0 +1,48 @@
<?php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: The "blank-theme" prefix is not a valid namespace/function/class/variable/constant prefix in PHP (WordPress.NamingConventions.PrefixAllGlobals.InvalidPrefixPassed).

Copy link
Contributor

@rtBot rtBot left a 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:

🚫 1 error

⚠️ 2 warnings


hashes-api-scanning skipped

* @codeCoverageIgnore
*/
public function enqueue_customizer_scripts() {
wp_enqueue_script(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Version parameter is not explicitly set or has been set to an equivalent of "false" for wp_enqueue_script; This means that the WordPress core version will be used which is not recommended for plugin or theme development (WordPress.WP.EnqueuedResourceParameters.NoExplicitVersion).

}

if ( ! empty( $wp_customize->get_setting( 'blogdescription' ) ) ) {
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: Equals sign not aligned correctly; expected 1 space but found 2 spaces (Generic.Formatting.MultipleStatementAlignment.IncorrectWarning).

$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
if ( ! empty( $wp_customize->get_setting( 'blogname' ) ) ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: Equals sign not aligned correctly; expected 1 space but found 9 spaces (Generic.Formatting.MultipleStatementAlignment.IncorrectWarning).

Copy link
Contributor

@rtBot rtBot left a 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:

🚫 1 error


hashes-api-scanning skipped

get_template_directory_uri() . '/assets/build/js/admin/customizer.js',
[ 'customize-preview' ],
false,
false, // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NoExplicitVersion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Only one argument is allowed per line in a multi-line function call (PEAR.Functions.FunctionCallSignature.MultipleArguments).

@deepaklalwani97 deepaklalwani97 changed the title [WIP] Adds Unit Test Adds Unit Test Mar 24, 2020
Copy link
Member

@sagarnasit sagarnasit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deepaklalwani97 Added couple of feedback, everything else looks good.

- Sync complete `build` directory on server.
- Before code push to repository, make sure you lint your code using `npm run precommit` command.

## Contributing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We slightly updated our contributor's workflow content, To align with that please update flow here. You can refer https://github.com/rtCamp/edit-flow-slack-integration

Comment on lines 106 to 108
$this->assertEquals( 10, has_filter( 'excerpt_more', array( $this->instance, 'add_read_more_link' ) ) );
$this->assertEquals( 10, has_filter( 'body_class', array( $this->instance, 'filter_body_classes' ) ) );
$this->assertEquals( 10, has_action( 'wp_head', array( $this->instance, 'add_pingback_link' ) ) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these duplicate test cases? does looping through $hooks cover this test cases?

@sagarnasit
Copy link
Member

@deepaklalwani97 I see lines are not 100% covered in test cases. Please add files for which test cases are not needed in the unit test ignore.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants