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

Calypsoify: fix Masterbar reference after its refactor #17939

Merged
merged 2 commits into from
Dec 3, 2020
Merged
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
5 changes: 3 additions & 2 deletions modules/calypsoify/class.jetpack-calypsoify.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Ported from an internal Automattic plugin.
*/

use Automattic\Jetpack\Dashboard_Customizations\Masterbar;
use Automattic\Jetpack\Redirect;
use Automattic\Jetpack\Status;

Expand Down Expand Up @@ -76,8 +77,8 @@ public function admin_color_override( $color ) {
}

public function mock_masterbar_activation() {
include_once JETPACK__PLUGIN_DIR . 'modules/masterbar/masterbar.php';
new A8C_WPCOM_Masterbar;
include_once JETPACK__PLUGIN_DIR . 'modules/masterbar/masterbar/class-masterbar.php';
new Masterbar();
}

public function remove_core_menus() {
Expand Down
3 changes: 3 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
<testsuite name="comment-likes">
<directory prefix="test" suffix=".php">tests/php/modules/comment-likes</directory>
</testsuite>
<testsuite name="calypsoify">
<directory prefix="test" suffix=".php">tests/php/modules/calypsoify</directory>
</testsuite>
<testsuite name="likes">
<directory prefix="test_" suffix=".php">tests/php/modules/likes</directory>
</testsuite>
Expand Down
37 changes: 37 additions & 0 deletions tests/php/modules/calypsoify/test-class.jetpack-calypsoify.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* Class Calypsoify.
*
* @package Jetpack
*/

require_jetpack_file( 'modules/calypsoify/class.jetpack-calypsoify.php' );

/**
* Class WP_Test_Jetpack_Calypsoify
*/
class WP_Test_Jetpack_Calypsoify extends WP_UnitTestCase {

/**
* Sets up each test.
*
* @inheritDoc
*/
public function setUp() {
parent::setUp();
$this->instance = Jetpack_Calypsoify::getInstance();
}

/**
* Sets up the Masterbar mock.
*
* For sites when Masterbar is not active, we mock it. This test confirms that functions.
*
* @covers Jetpack_Calypsoify::mock_masterbar_activation
* @see https://github.com/Automattic/jetpack/pull/17939
*/
public function test_mock_masterbar_activation() {
$this->instance->mock_masterbar_activation();
$this->assertTrue( class_exists( '\Automattic\Jetpack\Dashboard_Customizations\Masterbar' ) );
}
}