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 Net_Gearman_Job_Example extends Net_Gearman_Job_Common | |
{ | |
public function run ($arg) | |
{ | |
print $arg.PHP_EOL; | |
} | |
} |
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 | |
define('NET_GEARMAN_JOB_PATH', __DIR__); | |
require_once ('Net/Gearman/Worker.php'); | |
try | |
{ | |
print("[Gearman] starting worker..."); | |
$worker = new Net_Gearman_Worker(array('127.0.0.1:4730')); | |
$worker->addAbility('Example'); | |
$worker->beginWork(); |
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
<?xml version="1.0"?> | |
<project name="lithium-app" default="main"> | |
<target name="main"> | |
<taskdef classname="Li3_TestTask" name="li3test" /> | |
<li3test li3Base="." tests="app\tests" /> | |
</target> | |
</project> |
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 | |
namespace app\tests\mocks\action; | |
class Request extends \lithium\action\Request | |
{ | |
public function _base() { | |
$this->_base = '/'; | |
} |
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 | |
namespace app\tests\mocks\models; | |
use lithium\data\collection\RecordSet; | |
class Articles extends \app\models\Articles { | |
public static function find($type = 'all', array $options = array()) { |
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 | |
protected $_classes = array( | |
'media' => 'lithium\net\http\Media', | |
'router' => 'lithium\net\http\Router', | |
'response' => 'app\tests\mocks\action\MockControllerResponse', | |
'articles' => '\app\tests\mocks\models\Articles' | |
); |
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 | |
protected $_classes = array( | |
'media' => 'lithium\net\http\Media', | |
'router' => 'lithium\net\http\Router', | |
'response' => 'lithium\action\Response', | |
'articles' => '\app\models\Articles' | |
); | |
public function archives() { | |
$articlesClass = $this->_classes['articles']; |
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 | |
namespace app\tests\cases\controllers; | |
use app\controllers\ArticlesController; | |
use app\tests\mocks\controllers\MockArticlesController; | |
use lithium\action\Request; | |
class ArticlesControllerTest extends \lithium\test\Unit { |
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 | |
namespace app\tests\mocks\action; | |
class MockControllerResponse extends \lithium\action\Response { | |
public $hasRendered = false; | |
public function render() { | |
$this->hasRendered = true; |
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 | |
namespace app\tests\mocks\controllers; | |
use app\controllers\ArticlesController; | |
class MockArticlesController extends ArticlesController { | |
protected $_classes = array( | |
'media' => 'lithium\net\http\Media', |