本文整理汇总了PHP中test类的典型用法代码示例。如果您正苦于以下问题:PHP test类的具体用法?PHP test怎么用?PHP test使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了test类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: asd
function asd()
{
$newClass = new test();
$rows = $newClass->traerAlgoDesdeLaDb();
$viewData = array("id" => 5, "datos" => $rows);
View::Show($viewData);
}
示例2: assert_equal_array
public function assert_equal_array($expected, $actual, $debug = null)
{
if ($expected !== $actual) {
throw new Kohana_Unit_Test_Exception(sprintf("Expected (%s) %s but received (%s) %s\n Diff: %s", gettype($expected), var_export($expected, true), gettype($actual), var_export($actual, true), test::diff(var_export($expected, true), var_export($actual, true))), $debug);
}
return $this;
}
示例3: random_tag
static function random_tag()
{
$tag = ORM::factory("tag");
$tag->name = test::lorem_ipsum(rand(2, 4));
// Reload so that ORM coerces all fields into strings.
return $tag->save()->reload();
}
示例4: testTranslateInto
public function testTranslateInto()
{
$expectedFromTranslate = "MOCKED_RESULT";
$this->mockedTranslator = test::double('Translator', ['translate' => '$expectedFromTranslate']);
$result = $this->numbers->translateInto(2, "MOCKED");
$this->assertEquals($expectedFromTranslate, $result, "Incorrect value returned from translateInto()");
}
示例5: resolve_test
public function resolve_test()
{
$album = test::random_album();
$tag = tag::add($album, "tag1")->reload();
$tuple = rest::resolve(rest::url("tag_item", $tag, $album));
$this->assert_equal_array($tag->as_array(), $tuple[0]->as_array());
$this->assert_equal_array($album->as_array(), $tuple[1]->as_array());
}
示例6: add_user_to_group_test
public function add_user_to_group_test()
{
$user = test::random_user();
$group = test::random_group();
$group->add($user);
$group->save();
$this->assert_true($user->has($group));
}
示例7: selectById
public function selectById($thepage, $id)
{
switch ($thepage) {
case 'test':
$test = new test();
$result = $test->select($_GET['id']);
break;
default:
//$this->common_add($_POST,$thepage);
break;
}
if ($result) {
return $result;
} else {
return NULL;
}
}
示例8: _before
protected function _before()
{
$this->apigen = test::double('Robo\\Task\\ApiGen\\ApiGen', ['executeCommand' => null, 'output' => new \Symfony\Component\Console\Output\NullOutput()]);
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
$this->testDir = __DIR__ . '..' . DS . '..' . DS . 'data' . DS;
$this->testFile = $this->testDir . 'dump.sql';
}
示例9: factory
static function factory($x)
{
if (test::$test) {
return test::$test;
} else {
test::$test = new test($x);
return test::$test;
}
}
示例10: getInstance
public static function getInstance()
{
if (self::$instance == null) {
self::$instance = new test('Singleton1');
} else {
echo "Using old class " . self::$instance->myname . "\n";
}
return self::$instance;
}
示例11: build_breadcrumbs_for_item_test
public function build_breadcrumbs_for_item_test()
{
$album = test::random_album();
$item = test::random_photo($album);
$expected = array();
$expected[] = Breadcrumb::instance(item::root()->title, item::root()->url("show={$album->id}"))->set_first();
$expected[] = Breadcrumb::instance($album->title, $album->url("show={$item->id}"));
$expected[] = Breadcrumb::instance($item->title, $item->url())->set_last();
$this->assert_equal($expected, Breadcrumb::array_from_item_parents($item));
}
示例12: _get_proxy
private function _get_proxy()
{
$album = test::random_album();
$photo = test::random_photo($album);
access::deny(identity::everybody(), "view_full", $album);
access::deny(identity::registered_users(), "view_full", $album);
$proxy = ORM::factory("digibug_proxy");
$proxy->uuid = random::hash();
$proxy->item_id = $photo->id;
return $proxy->save();
}
示例13: create_tag_test
public function create_tag_test()
{
$album = test::random_album();
tag::add($album, "tag1");
$tag = ORM::factory("tag")->where("name", "=", "tag1")->find();
$this->assert_true(1, $tag->count);
// Make sure adding the tag again doesn't increase the count
tag::add($album, "tag1");
$this->assert_true(1, $tag->reload()->count);
tag::add(test::random_album(), "tag1");
$this->assert_true(2, $tag->reload()->count);
}
示例14: deleting_an_item_deletes_its_comments_too_test
public function deleting_an_item_deletes_its_comments_too_test()
{
$album = test::random_album();
$comment = ORM::factory("comment");
$comment->item_id = $album->id;
$comment->author_id = identity::guest()->id;
$comment->guest_name = "test";
$comment->text = "text";
$comment->save();
$album->delete();
$this->assert_false(ORM::factory("comment", $comment->id)->loaded());
}
示例15: validate_config
/**
* Validate item config
*
* @since 0.3.0
*
* @access protected
*
* @param array $data Item config
*
* @return bool|array Item config array if valid, false if not.
*/
protected static function validate_config($data)
{
if (!isset($data['created'])) {
$data['created'] = current_time('mysql');
}
if (!isset($data['IP'])) {
$data['IP'] = ingot_get_ip();
}
if (!isset($data['uID'])) {
$data['uID'] = get_current_user_id();
}
if (!isset($data['slug'])) {
$data['slug'] = self::get_slug();
}
if (!isset($data['used'])) {
$data['used'] = 0;
}
if (isset($data['click_test_ID'])) {
$data['click_test_ID'] = absint($data['click_test_ID']);
} else {
$data['click_test_ID'] = 0;
}
if ($data['click_test_ID']) {
$test = test::read($data['click_test_ID']);
if (!is_array($test)) {
$data['click_test_ID'] = 0;
}
}
if (isset($data['click_url'])) {
$data['click_url'] = esc_url_raw($data['click_url']);
} else {
$data['click_url'] = '';
}
if (!isset($data['ingot_ID'])) {
$data['ingot_ID'] = self::find_ingot_id($data['uID'], $data['IP']);
}
$data['used'] = (bool) $data['used'];
$data['used'] = (int) $data['used'];
foreach (self::required() as $key) {
if (!isset($data[$key])) {
return new \WP_Error('ingot-session-crud-validation-fail', '', array('fail-key' => $key, 'data' => $data));
}
}
$allowed = array_merge(self::required(), self::needed());
foreach ($data as $key => $datum) {
if (!in_array($key, $allowed)) {
unset($data[$key]);
} elseif (is_numeric($datum)) {
$data[$key] = (string) $datum;
}
}
return $data;
}