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

Update wp-browser to v3.5 #2064

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@
"require-dev": {
"automattic/vipwpcs": "^3.0",
"bordoni/phpass": "0.3.5",
"codeception/codeception": "^2.5.5",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
"lucatume/codeception-snapshot-assertions": "^0.2.4",
"lucatume/function-mocker-le": "^1.0",
"lucatume/wp-browser": "^3.0.14",
"lucatume/wp-browser": "^3.5",
"stellarwp/coding-standards": "dev-main",
"the-events-calendar/tec-testing-facilities": "dev-master",
"wp-cli/checksum-command": "1.0.5",
"wp-coding-standards/wpcs": "^3.0.0"
"wp-coding-standards/wpcs": "^3.0.0",
"phpspec/prophecy": "^1.19",
"phpspec/prophecy-phpunit": "^2.2"
},
"autoload": {
"psr-4": {
Expand Down
3,780 changes: 1,896 additions & 1,884 deletions composer.lock

Large diffs are not rendered by default.

703 changes: 634 additions & 69 deletions tests/_data/empty.sql

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions tests/activation.suite.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ modules:
- Asserts
config:
WPDb:
dsn: 'mysql:host=%DB_HOST%;dbname=%DB_NAME%'
user: %DB_USER%
password: %DB_PASSWORD%
dbUrl: 'mysql://%DB_USER%:%DB_PASSWORD%@%DB_HOST%/%DB_NAME%'
dump: tests/_data/empty.sql
populate: true
cleanup: false # See activation/_bootstrap for the cleanup.
Expand Down
4 changes: 1 addition & 3 deletions tests/dependency.suite.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ modules:
- Asserts
config:
WPDb:
dsn: 'mysql:host=%DB_HOST%;dbname=%DB_NAME%'
user: %DB_USER%
password: %DB_PASSWORD%
dbUrl: 'mysql://%DB_USER%:%DB_PASSWORD%@%DB_HOST%/%DB_NAME%'
dump: tests/_data/dependency-dump.sql
populate: true
cleanup: true
Expand Down
7 changes: 1 addition & 6 deletions tests/integration.suite.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@ modules:
- \Helper\Integration
- WPLoader:
wpRootFolder: %WP_ROOT_FOLDER%
dbName: %TEST_DB_NAME%
dbHost: %TEST_DB_HOST%
dbUser: %TEST_DB_USER%
dbPassword: %TEST_DB_PASSWORD%
dbUrl: 'mysql://%DB_USER%:%DB_PASSWORD%@%DB_HOST%/%DB_NAME%'
domain: %WP_DOMAIN%
adminEmail: admin@%WP_DOMAIN%
title: 'Event Common Tests'
plugins:
- the-events-calendar/the-events-calendar.php
activatePlugins:
- the-events-calendar/the-events-calendar.php
4 changes: 2 additions & 2 deletions tests/integration/File_Logging_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Tribe__Log__Logger,
Tribe__Main;

class Logging_Test extends WPTestCase {
class File_Logging_Test extends WPTestCase {
/**
* @var Tribe__Log
*/
Expand All @@ -24,7 +24,7 @@ class Logging_Test extends WPTestCase {
*/
protected $test_dates = array();

public function setUp() {
public function setUp(): void {
parent::setUp();

$this->use_test_prefix();
Expand Down
11 changes: 2 additions & 9 deletions tests/integration/Updater_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
class Updater_Test extends \Codeception\TestCase\WPTestCase {

/**
* @test
* @since 4.9.4
*/
public function test_update_required() {
Expand All @@ -31,7 +30,6 @@ public function test_update_required() {
}

/**
* @test
* @since 4.9.4
*/
public function test_get_version_from_db() {
Expand All @@ -45,7 +43,6 @@ public function test_get_version_from_db() {
}

/**
* @test
* @since 4.9.4
*/
public function test_update_version_option() {
Expand All @@ -64,7 +61,6 @@ public function test_update_version_option() {
}

/**
* @test
* @since 4.9.4
*/
public function test_get_update_callbacks() {
Expand All @@ -73,12 +69,11 @@ public function test_get_update_callbacks() {

$updates = $updater->get_update_callbacks();
foreach ( $updates as $version => $update_callable ) {
$this->assertTrue( is_callable( $update_callable ), "checking defined update function is callable ($version)" );
$this->assertIsCallable( $update_callable, "checking defined update function is callable ($version)" );
}
}

/**
* @test
* @since 4.9.4
*/
public function test_get_constant_update_callbacks() {
Expand All @@ -87,12 +82,11 @@ public function test_get_constant_update_callbacks() {

$contant_updates = $updater->get_constant_update_callbacks();
foreach ( $contant_updates as $contant_update_callable ) {
$this->assertTrue( is_callable( $contant_update_callable ), 'checking constant update function is callable' );
$this->assertIsCallable( $contant_update_callable, 'checking constant update function is callable' );
}
}

/**
* @test
* @since 4.9.4
*/
public function test_constant_updates_applied() {
Expand All @@ -108,7 +102,6 @@ public function test_constant_updates_applied() {
}

/**
* @test
* @since 4.9.4
*/
public function test_update_only_runs_once() {
Expand Down
7 changes: 1 addition & 6 deletions tests/muwpunit.suite.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@ modules:
- WPLoader:
multisite: true
wpRootFolder: %WP_ROOT_FOLDER%
dbName: %TEST_DB_NAME%
dbHost: %TEST_DB_HOST%
dbUser: %TEST_DB_USER%
dbPassword: %TEST_DB_PASSWORD%
dbUrl: 'mysql://%DB_USER%:%DB_PASSWORD%@%DB_HOST%/%DB_NAME%'
domain: %WP_DOMAIN%
adminEmail: admin@tribe.localhost
title: 'Event Common Tests'
plugins:
- the-events-calendar/the-events-calendar.php
activatePlugins:
- the-events-calendar/the-events-calendar.php
9 changes: 1 addition & 8 deletions tests/muwpunit/Tribe/PUE/CheckerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CheckerTest extends \Codeception\TestCase\WPTestCase {
*/
protected $network_plugin_file = 'the-events-calendar/the-events-calendar.php';

public function setUp() {
public function setUp(): void {
// before
parent::setUp();

Expand All @@ -50,13 +50,6 @@ public function setUp() {
$this->main_site = $current_site->blog_id;
}

public function tearDown() {
// your tear down methods here

// then
parent::tearDown();
}

/**
* @test
* it should be instantiatable
Expand Down
15 changes: 0 additions & 15 deletions tests/muwpunit/Tribe/SettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,6 @@
use Tribe__Settings as Settings;

class SettingsTest extends \Codeception\TestCase\WPTestCase {

public function setUp() {
// before
parent::setUp();

// your set up methods here
}

public function tearDown() {
// your tear down methods here

// then
parent::tearDown();
}

/**
* @test
* it should be instantiatable
Expand Down
7 changes: 1 addition & 6 deletions tests/snapshots.suite.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@ modules:
- \Helper\Snapshots
- WPLoader:
wpRootFolder: %WP_ROOT_FOLDER%
dbName: %TEST_DB_NAME%
dbHost: %TEST_DB_HOST%
dbUser: %TEST_DB_USER%
dbPassword: %TEST_DB_PASSWORD%
dbUrl: 'mysql://%DB_USER%:%DB_PASSWORD%@%DB_HOST%/%DB_NAME%'
domain: %WP_DOMAIN%
adminEmail: admin@%WP_DOMAIN%
title: 'Event Common Tests'
plugins:
- the-events-calendar/the-events-calendar.php
activatePlugins:
- the-events-calendar/the-events-calendar.php
2 changes: 1 addition & 1 deletion tests/snapshots/Snapshot_Test_Case.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Snapshot_Test_Case extends \Codeception\TestCase\WPTestCase {
/**
* Sets up the template that will be used in the tests.
*/
public function setUp() {
public function setUp(): void {
parent::setUp();

if ( empty( $this->template_path ) ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="tribe-events-virtual-loader-wrap">
<div class="tribe-common">
<div class="tribe-events-loader__dots tribe-common-c-loader tribe-common-a11y-hidden" >
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="tribe-events-virtual-loader-wrap">
<div class="tribe-common">
<div class="tribe-events-loader__dots tribe-common-c-loader tribe-common-a11y-hidden" >
</div>
</div>
</div>
9 changes: 2 additions & 7 deletions tests/wpunit.suite.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ class_name: WpunitTester
modules:
enabled:
- \Helper\Wpunit
- WPQueries
- WPLoader:
wpRootFolder: %WP_ROOT_FOLDER%
dbName: %TEST_DB_NAME%
dbHost: %TEST_DB_HOST%
dbUser: %TEST_DB_USER%
dbPassword: %TEST_DB_PASSWORD%
dbUrl: 'mysql://%DB_USER%:%DB_PASSWORD%@%DB_HOST%/%DB_NAME%'
domain: %WP_DOMAIN%
adminEmail: admin@%WP_DOMAIN%
title: 'Event Common Tests'
plugins:
- the-events-calendar/the-events-calendar.php
activatePlugins:
- the-events-calendar/the-events-calendar.php
- WPQueries
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @package TEC\Common\Integration
*/
class Integration_AbstractTests {
public static function setUpBeforeClass() {
public static function setUpBeforeClass(): void {
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
Method name "setUpBeforeClass" in class Integration_AbstractTests is not in snake case format, try "set_up_before_class"

tribe_register_provider( Dummy_Plugin::class );
tribe_register_provider( Dummy_Theme::class );
tribe_register_provider( Dummy_Module::class );
Expand Down
5 changes: 0 additions & 5 deletions tests/wpunit/Template_Tags/DateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
use Tribe__Date_Utils;

class DateTest extends \Codeception\TestCase\WPTestCase {

protected function setUp() {
parent::setUp();
}

/**
* @test
*/
Expand Down
3 changes: 1 addition & 2 deletions tests/wpunit/Tribe/AdminHelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
use Tribe__Admin__Helpers as Admin_Helpers;

class AdminHelpersTest extends \Codeception\TestCase\WPTestCase {

function setUp() {
function setUp(): void {
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
Squiz.Scope.MethodScope.Missing
Visibility must be declared on method "setUp"

parent::setUp();

global $pagenow;
Expand Down
9 changes: 6 additions & 3 deletions tests/wpunit/Tribe/AssetsTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<?php
namespace Tribe;

use Prophecy\PhpUnit\ProphecyTrait;
use Tribe__Assets as Assets;
use Tribe__Main as Plugin;

class AssetsTest extends \Codeception\TestCase\WPTestCase {
use ProphecyTrait;

/**
* @test
*
Expand Down Expand Up @@ -44,8 +47,8 @@ public function it_should_have_translations() {

$translations_string = wp_scripts()->print_translations( $asset_slug, false );

$this->assertContains( $expected_msgid, $translations_string );
$this->assertContains( $expected_msgstr, $translations_string );
$this->assertStringContainsString( $expected_msgid, $translations_string );
$this->assertStringContainsString( $expected_msgstr, $translations_string );
}

public function get_script_tags() {
Expand Down Expand Up @@ -88,6 +91,6 @@ public function it_should_properly_had_module_type( $script_tag ) {

$script_tag = $assets->filter_modify_to_module( $script_tag, 'test-script' );

$this->assertContains( 'type="module"', $script_tag );
$this->assertStringContainsString( 'type="module"', $script_tag );
}
}
10 changes: 5 additions & 5 deletions tests/wpunit/Tribe/Body_ClassesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Body_ClassesTest extends \Codeception\TestCase\WPTestCase {

protected $class_object;

function setUp() {
function setUp(): void {
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
Squiz.Scope.MethodScope.Missing
Visibility must be declared on method "setUp"

parent::setUp();


Expand Down Expand Up @@ -112,7 +112,7 @@ public function it_should_return_an_associative_array() {
$class_array = $this->class_object->get_classes();

$this->assertTrue( array_key_exists( 'chupacabra', $class_array ) );
$this->assertTrue( $class_array['chupacabra'] === true );
$this->assertSame( $class_array['chupacabra'], true );
}

/**
Expand All @@ -125,7 +125,7 @@ public function it_should_return_an_array_of_strings() {

$class_array = $this->class_object->get_class_names();

$this->assertTrue( in_array( 'chupacabra', $class_array ) );
$this->assertContains( 'chupacabra', $class_array );
}

/**
Expand Down Expand Up @@ -217,7 +217,7 @@ public function it_should_return_an_unchanged_classlist_when_not_adding_to_queue
$this->create_mixed_classes();

$classes = tribe( Body_Classes::class )->add_body_classes( $classes );
$this->assertFalse( in_array( 'wolfman', $classes ) );
$this->assertNotContains( 'wolfman', $classes );
}

/**
Expand All @@ -231,7 +231,7 @@ public function it_should_return_an_unchanged_classlist_when_not_adding_to_class
$this->create_mixed_classes();

$classes = tribe( Body_Classes::class )->add_body_classes( $classes );
$this->assertFalse( in_array( 'wolfman', $classes ) );
$this->assertNotContains( 'wolfman', $classes );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/wpunit/Tribe/CacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function it_should_allow_setting_many_different_values_using_array_access
foreach ( $key_values as $key => $value ) {
// Attempt to add a longer cache key to trigger the md5() cache key logic.
$key .= __METHOD__ . '-' . $key;
$expected[ substr( $key, 0, 6 ) . '... => ' . $value ] = [ $key, $value ];
$expected[ substr( $key, 0, 6 ) . '... => some-long-text' ] = [ $key, $value ];
}

// Generate long keys with variety of values.
Expand Down
2 changes: 1 addition & 1 deletion tests/wpunit/Tribe/ContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function should_correctly_identify_new_posts() {
$this->assertFalse( $sut->is_new_post( array( $post_id, $second_post_id ) ) );
}

function setUp() {
function setUp(): void {
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
Squiz.Scope.MethodScope.Missing
Visibility must be declared on method "setUp"

parent::setUp();
global $pagenow;
$pagenow = null;
Expand Down
Loading
Loading