• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP test类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中test的典型用法代码示例。如果您正苦于以下问题:PHP test类的具体用法?PHP test怎么用?PHP test使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了test类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: asd

function asd()
{
    $newClass = new test();
    $rows = $newClass->traerAlgoDesdeLaDb();
    $viewData = array("id" => 5, "datos" => $rows);
    View::Show($viewData);
}
开发者ID:afliw,项目名称:ponponpon,代码行数:7,代码来源:testController.php


示例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;
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:7,代码来源:Gallery_Unit_Test_Case.php


示例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();
 }
开发者ID:assad2012,项目名称:gallery3-appfog,代码行数:7,代码来源:test.php


示例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()");
 }
开发者ID:JoshuaReneDalley,项目名称:php,代码行数:7,代码来源:NumbersTest.php


示例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());
 }
开发者ID:andyst,项目名称:gallery3,代码行数:8,代码来源:Tag_Item_Rest_Helper_Test.php


示例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));
 }
开发者ID:andyst,项目名称:gallery3,代码行数:8,代码来源:User_Groups_Test.php


示例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;
     }
 }
开发者ID:huangzhichao,项目名称:php_dwz,代码行数:17,代码来源:Control.class.php


示例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';
 }
开发者ID:jjok,项目名称:Robo,代码行数:9,代码来源:ResourceExistenceChecker.php


示例9: factory

 static function factory($x)
 {
     if (test::$test) {
         return test::$test;
     } else {
         test::$test = new test($x);
         return test::$test;
     }
 }
开发者ID:lihuibin,项目名称:jphp,代码行数:9,代码来源:factory_and_singleton_001.php


示例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;
 }
开发者ID:badlamer,项目名称:hhvm,代码行数:9,代码来源:bug32322.php


示例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));
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:10,代码来源:Breadcrumb_Test.php


示例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();
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:11,代码来源:Digibug_Controller_Test.php


示例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);
 }
开发者ID:Joe7,项目名称:gallery3,代码行数:12,代码来源:Tag_Test.php


示例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());
 }
开发者ID:andyst,项目名称:gallery3,代码行数:12,代码来源:Comment_Event_Test.php


示例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;
 }
开发者ID:Ramoonus,项目名称:ingot,代码行数:64,代码来源:session.php


示例16: generateWithParams

 public function generateWithParams()
 {
     //the posted value from dimensions is inserted into the session variable
     $_SESSION["dimension"] = $_POST["dimension"];
     $_SESSION["startNrPlants"] = $_POST["startNrPlants"];
     $_SESSION["startNrCarnivores"] = $_POST["startNrCarnivore"];
     $_SESSION["startNrHerbivores"] = $_POST["startNrHerbivore"];
     //If the amount of plants+Carnivores+Herbivores is higher than the amount of squares in the matrix
     //then there is a message for the matrix being too full.
     if ($_SESSION["startNrPlants"] + $_SESSION["startNrCarnivores"] + $_SESSION["startNrHerbivores"] >= pow($_SESSION["dimension"], 2)) {
         include 'Presentation/home.php';
     } else {
         $matrix = new test();
         $_SESSION['days'] = $matrix->simulate();
         $days = $_SESSION['days'];
         $_SESSION['daynumber'] = 0;
         $daynumber = $_SESSION['daynumber'];
         $day = $days[$daynumber];
         include 'Presentation/home.php';
         //header("location: ../Presentation/home.php");
     }
 }
开发者ID:liesenborghspuntkristof,项目名称:Jurassic_Terrarium,代码行数:22,代码来源:HomeController.php


示例17: viewable_test

 public function viewable_test()
 {
     $album = test::random_album();
     $item = test::random_photo($album);
     $album->reload();
     identity::set_active_user(identity::guest());
     // We can see the item when permissions are granted
     access::allow(identity::everybody(), "view", $album);
     $this->assert_equal(1, ORM::factory("item")->viewable()->where("id", "=", $item->id)->count_all());
     // We can't see the item when permissions are denied
     access::deny(identity::everybody(), "view", $album);
     $this->assert_equal(0, ORM::factory("item")->viewable()->where("id", "=", $item->id)->count_all());
 }
开发者ID:joericochuyt,项目名称:gallery3,代码行数:13,代码来源:Item_Helper_Test.php


示例18: rename_merge_tag_with_same_items_test

 public function rename_merge_tag_with_same_items_test()
 {
     $album = test::random_album();
     tag::add($album, "tag1");
     tag::add($album, "tag2");
     $tag1 = ORM::factory("tag")->where("name", "=", "tag1")->find();
     $tag1->name = "tag2";
     $tag1->save();
     // Tags should be merged
     $tag1->reload();
     $this->assert_equal(1, $tag1->count);
     $this->assert_true($tag1->has($album));
     $this->assert_equal(1, ORM::factory("tag")->count_all());
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:14,代码来源:Tag_Test.php


示例19: cant_view_comments_for_unviewable_items_test

 public function cant_view_comments_for_unviewable_items_test()
 {
     $album = test::random_album();
     $comment = ORM::factory("comment");
     $comment->item_id = $album->id;
     $comment->author_id = identity::admin_user()->id;
     $comment->text = "text";
     $comment->save();
     identity::set_active_user(identity::guest());
     // We can see the comment when permissions are granted on the album
     access::allow(identity::everybody(), "view", $album);
     $this->assert_true(ORM::factory("comment")->viewable()->where("comments.id", "=", $comment->id)->count_all());
     // We can't see the comment when permissions are denied on the album
     access::deny(identity::everybody(), "view", $album);
     $this->assert_false(ORM::factory("comment")->viewable()->where("comments.id", "=", $comment->id)->count_all());
 }
开发者ID:kandsten,项目名称:gallery3,代码行数:16,代码来源:Comment_Model_Test.php


示例20: change_album_no_csrf_fails_test

 public function change_album_no_csrf_fails_test()
 {
     $controller = new Albums_Controller();
     $album = test::random_album();
     $_POST["name"] = "new name";
     $_POST["title"] = "new title";
     $_POST["description"] = "new description";
     access::allow(identity::everybody(), "edit", item::root());
     try {
         $controller->update($album->id);
         $this->assert_true(false, "This should fail");
     } catch (Exception $e) {
         // pass
         $this->assert_same("@todo FORBIDDEN", $e->getMessage());
     }
 }
开发者ID:assad2012,项目名称:gallery3-appfog,代码行数:16,代码来源:Albums_Controller_Test.php



注:本文中的test类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP test_question_maker类代码示例发布时间:2022-05-23
下一篇:
PHP templates类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap