Skip to content

Commit

Permalink
[Version] 0.05
Browse files Browse the repository at this point in the history
Removed dev dependancies and PHPUNIT 9 deprecation support
  • Loading branch information
bainternet committed Nov 18, 2021
1 parent 2df2227 commit 92b681c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
10 changes: 1 addition & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "elementor/eunit",
"description": "WordPress PHPUnit Testing Library",
"version": "0.0.4",
"version": "0.0.5",
"authors": [
{
"name": "ohad",
Expand All @@ -13,13 +13,5 @@
},
"autoload": {
"files": [ "src/eunit.php" ]
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"squizlabs/php_codesniffer": "^3.6",
"phpcompatibility/php-compatibility": "^9.3",
"wp-coding-standards/wpcs": "^2.3",
"sirbrillig/phpcs-variable-analysis": "^2.8",
"wp-phpunit/wp-phpunit": "^5.7.2"
}
}
7 changes: 4 additions & 3 deletions src/traits/assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function assert_script_not_enqueued( string $handle ) : void {
public function assert_style_enqueued( string $handle ) : void {
// phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet
$style_link_tag = "<link rel='stylesheet' id='${handle}-css'";
$this->assertContains( $style_link_tag, get_echo( 'wp_print_styles' ),
$this->assertStringContainsString( $style_link_tag, get_echo( 'wp_print_styles' ),
'Test ' . $handle . ' style is enqueued if needed'
);
}
Expand All @@ -44,7 +44,8 @@ public function assert_style_enqueued( string $handle ) : void {
public function assert_style_not_enqueued( string $handle ) : void {
// phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet
$style_link_tag = "<link rel='stylesheet' id='${handle}-css'";
$this->assertNotContains( $style_link_tag, get_echo( 'wp_print_styles' ),
$actual = get_echo( 'wp_print_styles' );
$this->assertStringNotContainsString()( $style_link_tag, $actual,
'Test ' . $handle . ' style is not enqueued if not needed'
);
}
Expand All @@ -62,7 +63,7 @@ public function assert_style_not_enqueued( string $handle ) : void {
public function assert_localized_script( string $handle, string $variable, bool $return = true ) : array {
global $wp_scripts;
$data = $wp_scripts->get_data( $handle, 'data' );
$this->assertContains( 'var ' . $variable, $data,
$this->assertStringContainsString( 'var ' . $variable, $data,
'Test that ' . $variable . ' var is enqueued'
);
if ( $return ) {
Expand Down

0 comments on commit 92b681c

Please sign in to comment.