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 into
developfrom
dev-unit-test
Open

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

Conversation

@vaishaliagola27
Copy link
Copy Markdown
Collaborator

@vaishaliagola27 vaishaliagola27 commented Feb 21, 2020

Copy link
Copy Markdown
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)

Comment thread tests/test-sample.php Outdated
@@ -0,0 +1,20 @@
<?php
Copy link
Copy Markdown
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).

Comment thread tests/bootstrap.php
});
add_filter( 'pre_option_stylesheet', function() use ( $current_theme ) {
return $current_theme;
});
Copy link
Copy Markdown
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).

Comment thread tests/bootstrap.php
add_filter( 'pre_option_template', function() use ( $current_theme ) {
return $current_theme;
});
add_filter( 'pre_option_stylesheet', function() use ( $current_theme ) {
Copy link
Copy Markdown
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).

Comment thread tests/bootstrap.php
add_filter( 'pre_option_template', function() use ( $current_theme ) {
return $current_theme;
});
add_filter( 'pre_option_stylesheet', function() use ( $current_theme ) {
Copy link
Copy Markdown
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).

Comment thread tests/bootstrap.php

add_filter( 'pre_option_template', function() use ( $current_theme ) {
return $current_theme;
});
Copy link
Copy Markdown
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).

Comment thread tests/bootstrap.php

register_theme_directory( $theme_root );

add_filter( 'pre_option_template', function() use ( $current_theme ) {
Copy link
Copy Markdown
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).

Comment thread tests/bootstrap.php

register_theme_directory( $theme_root );

add_filter( 'pre_option_template', function() use ( $current_theme ) {
Copy link
Copy Markdown
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).

Comment thread tests/bootstrap.php

add_filter( 'theme_root', function() use ( $theme_root ) {
return $theme_root;
} );
Copy link
Copy Markdown
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).

Comment thread tests/bootstrap.php
$current_theme = basename( $theme_dir );
$theme_root = dirname( $theme_dir );

add_filter( 'theme_root', function() use ( $theme_root ) {
Copy link
Copy Markdown
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).

Comment thread tests/bootstrap.php
$current_theme = basename( $theme_dir );
$theme_root = dirname( $theme_dir );

add_filter( 'theme_root', function() use ( $theme_root ) {
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread tests/bootstrap.php

$theme_dir = dirname( __DIR__ );
$current_theme = basename( $theme_dir );
$theme_root = dirname( $theme_dir );
Copy link
Copy Markdown
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).

Comment thread tests/bootstrap.php
*/
function _register_theme() {

$theme_dir = dirname( __DIR__ );
Copy link
Copy Markdown
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).

Comment thread tests/bootstrap.php
/**
* Registers theme
*/
function _register_theme() {
Copy link
Copy Markdown
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).

Comment thread tests/bootstrap.php
}

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
Copy Markdown
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).

Comment thread tests/bootstrap.php
$_tests_dir = getenv( 'WP_TESTS_DIR' );

if ( ! $_tests_dir ) {
$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
Copy link
Copy Markdown
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).

Comment thread tests/bootstrap.php
* @package Blank_Theme
*/

$_tests_dir = getenv( 'WP_TESTS_DIR' );
Copy link
Copy Markdown
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).

Comment thread tests/bootstrap.php
@@ -0,0 +1,48 @@
<?php
Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread inc/classes/class-customizer.php Outdated
* @codeCoverageIgnore
*/
public function enqueue_customizer_scripts() {
wp_enqueue_script(
Copy link
Copy Markdown
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).

Comment thread inc/classes/class-customizer.php Outdated
}

if ( ! empty( $wp_customize->get_setting( 'blogdescription' ) ) ) {
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
Copy link
Copy Markdown
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).

Comment thread inc/classes/class-customizer.php Outdated
$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
Copy Markdown
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
Copy Markdown
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

Comment thread inc/classes/class-customizer.php Outdated
get_template_directory_uri() . '/assets/build/js/admin/customizer.js',
[ 'customize-preview' ],
false,
false, // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NoExplicitVersion
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread README.md
- 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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