This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: More WpCli commands | |
* Plugin URI: http://notaurl.com | |
* Description: Some useful commands for wp-cli | |
* Author: Erik Torsner | |
* Author URI: http://erik.torgesta.com | |
* Version: 1.0. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
if(document.querySelector("#_CRIT_CSS")){return;} | |
var container = document.createElement("div"); | |
container.id = "_CRIT_CSS"; | |
container.innerHTML = '<textarea cols=80 rows=20></textarea><button id="CRIT_FIND">Find Critical CSS</button><button id="CRIT_CLOSE">Exit</button>'; | |
container.style.position = "fixed"; | |
container.style.top = 0; | |
container.style.left = 0; | |
container.style.right = 0; | |
container.style.backgroundColor = "#FFF"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Class Lyrics | |
* A class to encapsulate lyrics for a song | |
* | |
* @package helloTestable | |
*/ | |
class Lyrics | |
{ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* helloTestable constructor. | |
* | |
* @param Lyrics $lyrics | |
*/ | |
public function __construct($lyrics) | |
{ | |
$this->lyrics = $lyrics; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Hook up our plugin with WordPress | |
*/ | |
public function init() | |
{ | |
add_action('admin_notices', array($this, 'echoLyric')); | |
add_action('admin_head', array($this, 'echoCss')); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Output the lyric string | |
*/ | |
public function echoLyric() | |
{ | |
$lyricString = $this->lyrics->getLyric(); | |
echo "<p id='dolly'>$lyricString</p>"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function testRegister() | |
{ | |
$container = new Pimple\Container(); | |
$provider = new RuntimeProvider(); | |
$provider->register($container); | |
$this->assertInstanceOf('helloTestable\Lyrics', $container['lyrics']); | |
$this->assertInstanceOf('helloTestable\helloTestable', $container['helloTestable']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function testEchoCss() | |
{ | |
\WP_Mock::userFunction('is_rtl', array( | |
'return_in_order' => array(true, false), | |
)); | |
$dummy = new \stdClass(); | |
$hello = new helloTestable($dummy); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function testEchoLyric() | |
{ | |
$mockLyric = new \MockLyric('foobar'); | |
$hello = new helloTestable($mockLyric); | |
$this->expectOutputRegex('/.*foobar*./'); | |
$hello->echoLyric(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MockLyric | |
{ | |
public function __construct($lyric) | |
{ | |
$this->lyric = $lyric; | |
} | |
public function getLyric() |
OlderNewer