Skip to content

Instantly share code, notes, and snippets.

View mlively's full-sized avatar

Mike Lively mlively

  • Slickdeals.net
  • Denver, CO
  • 07:40 (UTC -07:00)
View GitHub Profile
<?php
/**
* Executes a mysql 5.5 safe truncate against all tables in a dataset.
*
* @package DbUnit
* @author Mike Lively <[email protected]>
* @copyright 2011 Mike Lively <[email protected]>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: @package_version@
@mlively
mlively / gist:1145400
Created August 14, 2011 22:40
Partial mock with no constructor call
<?php
$mock = Phake::mock('PhakeTest_MockedClass', Phake::ifUnstubbed()->thenCallParent());
//All calls will call the parent by default, you can still stub on an individual
//method basis and you can verify any call
?>
@mlively
mlively / MagicClass.php
Created March 5, 2011 18:30
MyBestPokerGameTest.php
<?php
class MagicClass
{
public function __call($method, $args)
{
return '__call';
}
}
?>
<?php
interface CardCollection
{
public function getNumberOfCards();
}
?>
pear channel-discover pear.digitalsandwich.com
pear install digitalsandwich/Phake
<?php
class CardGame
{
private $dealerStrategy;
private $deck;
private $players;
public function CardGame(DealerStrategy $dealerStrategy, CardCollection $deck, PlayerCollection $players)
{
<?php
class PhakeClass
{
public function __call($method, $args)
{
return '__call';
}
}