Skip to content

Instantly share code, notes, and snippets.

@heptat
Created May 17, 2012 06:33
Show Gist options
  • Save heptat/2717010 to your computer and use it in GitHub Desktop.
Save heptat/2717010 to your computer and use it in GitHub Desktop.
mock test
<?php
namespace app\tests\mocks\models;
use lithium\data\entity\Document;
use lithium\data\collection\DocumentSet;
class MockTests extends \app\models\Tests {
public static function &connection() {
if (isset($connection)) {
return $connection
$self = static::_object();
$connections = static::$_classes['connections'];
$name = isset($self->_meta['connection']) ? $self->_meta['connection'] : null;
if ($conn = $connections::get($name)) {
echo '<pre>';
print_r($conn);
echo '</pre>';
exit;_
return $conn;
}
throw new ConfigException("The data connection `{$name}` is not configured.");
}
}
$options = array(
'connection' => 'mock_mongo',
);
MockTests::config($options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment