%PDF-
%PDF-
Mini Shell
Mini Shell
<?php
/**
* Tests the StylesLoader class.
*
* @package GoDaddy_Styles
*/
use GoDaddy\Styles\StylesLoader;
use org\bovigo\vfs\vfsStream;
/**
* Tests the StylesLoader class.
*/
class StylesLoaderTest extends WP_UnitTestCase {
/**
* The StylesLoader instance.
*
* @var \GoDaddy\Styles\StylesLoader
*/
private $styles_loader;
/**
* The base_path of vfsStream.
*
* @var string
*/
private $plugin_base_path;
/**
* The base_url of vfsStream.
*
* @var string
*/
private $plugin_base_url;
public function set_up() {
parent::set_up();
$this->styles_loader = new StylesLoaderStub();
// Create a virtual filesyste to test against.
vfsStream::setup( 'root', null, array(
'wp-content' => array(
'plugins' => array(
'styles' => array(
'build' => array(
'latest.css' => '',
'wp' => array(
'5.8.0.css' => '',
'5.9.0.css' => '',
'5.9.1.css' => '',
'5.9.2.css' => '',
),
),
),
),
),
) );
$__DIR__ = 'wp-content/plugins/styles/';
$this->plugin_base_path = vfsStream::url( 'root' ) . '/' . $__DIR__;
$this->plugin_base_url = vfsStream::url( 'root' ) . '/' . $__DIR__;
}
public function tear_down() {
parent::tear_down();
$this->styles_loader = null;
unset( $GLOBALS['wp_styles'] );
}
/**
* TESTS:
* - If style handle has not already been enqueued, enqueue it.
* - If the current plugin is a mu-plugin, override any enqueued handle.
* - If style handle has been enqueued:
* - do nothing if the src is from the mu-plugin dir.
* - enqueue only if we're enqueuing a more recent version.
*/
public function test_has_registered_returns_false_if_missing() {
$this->assertEmpty( wp_styles()->registered[ $this->styles_loader::HANDLE ] );
$this->assertFalse( $this->styles_loader->hasRegistered() );
}
public function test_has_registered_returns_true_if_registered() {
wp_enqueue_style( $this->styles_loader::HANDLE, 'styles.css', array(), '1.0.0' );
$this->assertNotEmpty( wp_styles()->registered[ $this->styles_loader::HANDLE ] );
$this->assertTrue( $this->styles_loader->hasRegistered() );
}
public function test_get_registered_returns_array_or_false() {
$this->assertFalse( $this->styles_loader->getRegistered() );
wp_enqueue_style( $this->styles_loader::HANDLE, 'styles.css', array(), '1.0.0' );
$this->assertInstanceOf( _WP_Dependency::class, $this->styles_loader->getRegistered() );
}
public function test_is_must_use_returns_true_for_mu_plugin_path() {
wp_enqueue_style( $this->styles_loader::HANDLE, 'styles.css', array(), '1.0.0' );
$this->assertFalse( $this->styles_loader->isMustUse() );
wp_deregister_style( $this->styles_loader::HANDLE );
wp_enqueue_style( $this->styles_loader::HANDLE, 'mu-plugins/styles.css', array(), '1.0.0' );
$this->assertTrue( $this->styles_loader->isMustUse() );
}
public function test_boot_hooks_exist() {
$callback = array( $this->styles_loader, 'enqueue' );
$this->assertFalse( has_action( 'admin_enqueue_scripts', $callback ) );
$this->assertFalse( has_action( 'wp_enqueue_scripts', $callback ) );
$this->styles_loader->boot();
// Assert "not false" because has_action returns the priority of the hook if the callback exists.
$this->assertNotFalse( has_action( 'admin_enqueue_scripts', $callback ) );
$this->assertNotFalse( has_action( 'wp_enqueue_scripts', $callback ) );
}
public function test_skips_enqueue_when_older_version() {
$this->styles_loader->boot();
do_action( 'wp_enqueue_scripts' );
$this->assertEquals(
StylesLoaderStub::VERSION,
$this->styles_loader->getRegisteredVersion()
);
$older_styles_loader = new OlderStylesLoaderStub;
$older_styles_loader->boot();
do_action( 'wp_enqueue_scripts' );
$this->assertEquals(
StylesLoaderStub::VERSION,
$older_styles_loader->getRegisteredVersion()
);
}
public function test_enqueue_when_newer_version() {
$this->styles_loader->boot();
do_action( 'wp_enqueue_scripts' );
$this->assertEquals(
StylesLoaderStub::VERSION,
$this->styles_loader->getRegisteredVersion()
);
$newer_styles_loader = new NewerStylesLoaderStub;
$newer_styles_loader->boot();
do_action( 'wp_enqueue_scripts' );
$this->assertEquals(
NewerStylesLoaderStub::VERSION,
$newer_styles_loader->getRegisteredVersion()
);
}
public function test_skips_enqueue_when_mu_plugin_registered() {
$must_use_styles_loader = new MustUseStylesLoaderStub;
$must_use_styles_loader->boot();
$must_use_styles_loader->setBasePath( $this->plugin_base_path );
$must_use_styles_loader->setBaseUrl( $this->plugin_base_url );
do_action( 'wp_enqueue_scripts' );
$this->assertEquals(
MustUseStylesLoaderStub::VERSION,
$must_use_styles_loader->getRegisteredVersion()
);
$newer_styles_loader = new NewerStylesLoaderStub;
$newer_styles_loader->boot();
do_action( 'wp_enqueue_scripts' );
$this->assertEquals(
MustUseStylesLoaderStub::VERSION,
$newer_styles_loader->getRegisteredVersion()
);
}
public function test_enqueues_latest_styles_by_default() {
$this->styles_loader->boot();
do_action( 'wp_enqueue_scripts' );
$this->assertEquals(
'build/latest.css',
$this->styles_loader->getRegistered()->src
);
}
public function test_enqueues_wp_minor_version_styles() {
global $wp_version;
$wp_version = '5.9.1';
$this->styles_loader->boot();
$this->styles_loader->setBasePath( $this->plugin_base_path );
$this->styles_loader->setBaseUrl( $this->plugin_base_url );
do_action( 'wp_enqueue_scripts' );
$this->assertEquals(
'build/wp/5.9.1.css',
str_replace( $this->plugin_base_path, '', $this->styles_loader->getRegistered()->src )
);
}
public function test_enqueues_last_minor_version_stylesheet_for_wp_version() {
global $wp_version;
$wp_version = '5.8.3';
$this->styles_loader->boot();
$this->styles_loader->setBasePath( $this->plugin_base_path );
$this->styles_loader->setBaseUrl( $this->plugin_base_url );
do_action( 'wp_enqueue_scripts' );
$this->assertEquals(
'build/wp/5.8.0.css',
str_replace( $this->plugin_base_path, '', $this->styles_loader->getRegistered()->src )
);
}
public function test_enqueues_latest_stylesheet_for_new_major_wp_verion() {
global $wp_version;
$wp_version = '6.0.0';
$this->styles_loader->boot();
$this->styles_loader->setBasePath( $this->plugin_base_path );
$this->styles_loader->setBaseUrl( $this->plugin_base_url );
do_action( 'wp_enqueue_scripts' );
$this->assertEquals(
'build/latest.css',
str_replace( $this->plugin_base_path, '', $this->styles_loader->getRegistered()->src )
);
}
}
class StylesLoaderStub extends StylesLoader {
const VERSION = '1.0.0';
const HANDLE = 'godaddy-styles-testing';
}
class OlderStylesLoaderStub extends StylesLoader {
const VERSION = '0.1.0';
const HANDLE = 'godaddy-styles-testing';
}
class NewerStylesLoaderStub extends StylesLoader {
const VERSION = '2.0.0';
const HANDLE = 'godaddy-styles-testing';
}
class MustUseStylesLoaderStub extends StylesLoader {
const VERSION = '1.0.0';
const HANDLE = 'godaddy-styles-testing';
public function enqueue() {
$this->base_path = str_replace( 'plugins/', 'mu-plugins/', $this->base_path );
$this->base_url = str_replace( 'plugins/', 'mu-plugins/', $this->base_url );
parent::enqueue();
}
} Zerion Mini Shell 1.0
Custom Staffing Solutions | Beyond A Resume
Skip to content
Distinguish Your Business From The Rest With The People That Make Up Your Team
We go Beyond a Resume to find high value, committed people
ready, willing, and able to add true value toward your organization's mission.
The right people make or break your business
We focus on resolving two types of challenges surrounding staffing and recruiting at Beyond a Resume: The first challenge comes when a business continues to grow, but does not have the full-time, internal, talent acquisition resources to hire the right people or talent necessary to keep up with their rate of progression as a company.
The second is a business that has a dedicated internal Human Resources Team, but requires outsourced assistance when the volume of people and talent needed exceeds short term internal capacity, OR the position(s) they seek to fill demand a specific skill set that is difficult to find, requiring added bandwidth.
In nearly any line of business, growth is a challenge in and of itself. Yet, the real problems arise in managing growth to ensure your progress remains profitable, sustainable, and repeatable. The biggest factor in this equation is usually found in your people. When you have the right people, success is unlimited. On the other hand, when you don’t have the right people in place or are having trouble finding enough of the right people, failure or stagnation is imminent.
The frustration that comes with the process of “hiring” can bring you to new levels of stress as the time cost involved eats away at your production elsewhere. If you have experienced this in the past, or are currently struggling with this issue, you’re certainly not alone. You may simply need the right partner to take the worst parts of this process off your plate so you can concentrate on your responsibilities, while we work diligently to reduce the noise and deliver only the ideal candidates worth your time and attention.
People can make or break your business and we go Beyond a Resume to find high value, committed people ready, willing, and able to add true value.
Primary Industry Experience
Healthcare and Home Healthcare
Talent Acquisition Solutions
Statement of Work Projects
Scroll To Top