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

PHP pass函数代码示例

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

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



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

示例1: testBasicsDispense

 /**
  * Test dispense.
  *
  * @return void
  */
 public function testBasicsDispense()
 {
     $redbean = R::getRedBean();
     // Can we dispense a bean?
     $page = $redbean->dispense("page");
     // Does it have a meta type?
     asrt((bool) $page->getMeta("type"), TRUE);
     // Does it have an ID?
     asrt(isset($page->id), TRUE);
     // Type should be 'page'
     asrt($page->getMeta("type"), "page");
     // ID should be 0 because bean does not exist in database yet.
     asrt($page->id, 0);
     // Try some faulty dispense actions.
     foreach (array("", ".", "-") as $value) {
         try {
             $redbean->dispense($value);
             fail();
         } catch (RedException $e) {
             pass();
         }
     }
     $bean = $redbean->dispense("testbean");
     $bean["property"] = 123;
     $bean["abc"] = "def";
     asrt($bean["property"], 123);
     asrt($bean["abc"], "def");
     asrt($bean->abc, "def");
     asrt(isset($bean["abd"]), FALSE);
     asrt(isset($bean["abc"]), TRUE);
 }
开发者ID:AntonyAntonio,项目名称:phpback,代码行数:36,代码来源:Dispense.php


示例2: testChill

 /**
  * Test Chill mode.
  * 
  * @return void
  */
 public function testChill()
 {
     $bean = R::dispense('bean');
     $bean->col1 = '1';
     $bean->col2 = '2';
     R::store($bean);
     asrt(count(R::$writer->getColumns('bean')), 3);
     $bean->col3 = '3';
     R::store($bean);
     asrt(count(R::$writer->getColumns('bean')), 4);
     R::freeze(array('umbrella'));
     $bean->col4 = '4';
     R::store($bean);
     asrt(count(R::$writer->getColumns('bean')), 5);
     R::freeze(array('bean'));
     $bean->col5 = '5';
     try {
         R::store($bean);
         fail();
     } catch (Exception $e) {
         pass();
     }
     asrt(count(R::$writer->getColumns('bean')), 5);
     R::freeze(array());
     $bean->col5 = '5';
     R::store($bean);
     asrt(count(R::$writer->getColumns('bean')), 6);
 }
开发者ID:daviddeutsch,项目名称:redbean-adaptive,代码行数:33,代码来源:Chill.php


示例3: testTags

 /**
  * Some basic tests.
  * 
  * @return void
  */
 public function testTags()
 {
     list($c, $d, $e, $f) = R::dispense('coffee', 4);
     R::tag($c, 'strong,black');
     R::tag($d, 'black');
     R::tag($e, 'strong,sweet');
     R::tag($f, 'black,strong');
     //$x = array_intersect(R::tagged('coffee','sweet'),R::tagged('coffee','strong'));
     asrt(count(R::taggedAll('coffee', 'strong,sweet')), 1);
     asrt(count(R::taggedAll('coffee', 'strong')), 3);
     asrt(count(R::taggedAll('coffee', '')), 0);
     asrt(count(R::taggedAll('coffee', 'sweet')), 1);
     asrt(count(R::taggedAll('coffee', 'sweet,strong')), 1);
     asrt(count(R::taggedAll('coffee', 'black,strong')), 2);
     asrt(count(R::taggedAll('coffee', array('black', 'strong'))), 2);
     asrt(count(R::taggedAll('coffee', 'salty')), 0);
     $blog = R::dispense('blog');
     $blog->title = 'testing';
     $blog->blog = 'tesing';
     R::store($blog);
     $blogpost = R::load("blog", 1);
     $post = R::dispense("post");
     $post->message = "hello";
     R::tag($post, "lousy,smart");
     asrt(implode(',', R::tag($post)), "lousy,smart");
     R::tag($post, "clever,smart");
     $tagz = implode(',', R::tag($post));
     asrt($tagz == "smart,clever" || $tagz == "clever,smart", TRUE);
     R::tag($blog, array("smart", "interesting"));
     asrt(implode(',', R::tag($blog)), "smart,interesting");
     try {
         R::tag($blog, array("smart", "interesting", "lousy!"));
         pass();
     } catch (RedBean_Exception $e) {
         fail();
     }
     asrt(implode(',', R::tag($blog)), "smart,interesting,lousy!");
     R::untag($blog, array("smart", "interesting"));
     asrt(implode(",", R::tag($blog)), "lousy!");
     asrt(R::hasTag($blog, array("lousy!")), TRUE);
     asrt(R::hasTag($blog, array("lousy!", "smart")), TRUE);
     asrt(R::hasTag($blog, array("lousy!", "smart"), TRUE), FALSE);
     R::tag($blog, FALSE);
     asrt(count(R::tag($blog)), 0);
     R::tag($blog, array("funny", "comic"));
     asrt(count(R::tag($blog)), 2);
     R::addTags($blog, array("halloween"));
     asrt(count(R::tag($blog)), 3);
     asrt(R::hasTag($blog, array("funny", "commic", "halloween"), TRUE), FALSE);
     R::unTag($blog, "funny");
     R::addTags($blog, "horror");
     asrt(count(R::tag($blog)), 3);
     asrt(R::hasTag($blog, array("horror", "commic", "halloween"), TRUE), FALSE);
     //no double tags
     R::addTags($blog, "horror");
     asrt(R::hasTag($blog, array("horror", "commic", "halloween"), TRUE), FALSE);
     asrt(R::hasTag($blog, "horror,commic,halloween", TRUE), FALSE);
     asrt(count(R::tag($blog)), 3);
     testpack("fetch tagged items");
 }
开发者ID:daviddeutsch,项目名称:redbean-adaptive,代码行数:65,代码来源:Tags.php


示例4: testPlaysNiceWithPreExitsingSchema

 /**
  * Test integration with pre-existing schemas.
  * 
  * @return void
  */
 public function testPlaysNiceWithPreExitsingSchema()
 {
     $toolbox = R::$toolbox;
     $adapter = $toolbox->getDatabaseAdapter();
     $writer = $toolbox->getWriter();
     $redbean = $toolbox->getRedBean();
     $pdo = $adapter->getDatabase();
     $a = new RedBean_AssociationManager($toolbox);
     $page = $redbean->dispense("page");
     $page->name = "John's page";
     $idpage = $redbean->store($page);
     $page2 = $redbean->dispense("page");
     $page2->name = "John's second page";
     $idpage2 = $redbean->store($page2);
     $a->associate($page, $page2);
     $adapter->exec("ALTER TABLE " . $writer->esc('page') . "\n\t\tCHANGE " . $writer->esc('name') . " " . $writer->esc('name') . "\n\t\tVARCHAR( 254 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL ");
     $page = $redbean->dispense("page");
     $page->name = "Just Another Page In a Table";
     $cols = $writer->getColumns("page");
     asrt($cols["name"], "varchar(254)");
     //$pdo->SethMode(1);
     $redbean->store($page);
     pass();
     // No crash?
     $cols = $writer->getColumns("page");
     asrt($cols["name"], "varchar(254)");
     //must still be same
 }
开发者ID:daviddeutsch,项目名称:redbean-adaptive,代码行数:33,代码来源:Preexist.php


示例5: testDump

 /**
  * Test dump().
  *
  * @return void
  */
 public function testDump()
 {
     $beans = R::dispense('bean', 2);
     $beans[0]->name = 'hello';
     $beans[1]->name = 'world';
     $array = R::dump($beans);
     asrt(is_array($array), TRUE);
     foreach ($array as $item) {
         asrt(is_string($item), TRUE);
     }
     $beans[1]->name = 'world, and a very long string that should be shortened';
     $array = R::dump($beans);
     asrt(is_array($array), TRUE);
     asrt(strpos($array[1], '...'), 35);
     //just to get 100% test cov, we dont need to test this
     dmp($beans);
     pass();
     //test wrong input
     asrt(is_array(R::dump(NULL)), TRUE);
     asrt(count(R::dump(NULL)), 0);
     asrt(is_array(R::dump('')), TRUE);
     asrt(count(R::dump('')), 0);
     asrt(is_array(R::dump(1)), TRUE);
     asrt(count(R::dump(1)), 0);
     asrt(is_array(R::dump(TRUE)), TRUE);
     asrt(count(R::dump(FALSE)), 0);
 }
开发者ID:cesium147,项目名称:redbean,代码行数:32,代码来源:Debug.php


示例6: test_unset

function test_unset()
{
    $a = [1, 2, 3];
    assert(count($a) === 3);
    unset($a[0]);
    assert(count($a) === 2);
    pass(__FUNCTION__);
}
开发者ID:JohnsonCheung,项目名称:try,代码行数:8,代码来源:unset.php


示例7: TypeColumn

 /**
  * Test meta column type.
  * 
  * @return void
  */
 public function TypeColumn()
 {
     $book = R::dispense('book');
     $page = R::dispense('page');
     $page->book = $book;
     R::store($page);
     pass();
     asrt($page->getMeta('cast.book_id'), 'id');
 }
开发者ID:skullyframework,项目名称:skully,代码行数:14,代码来源:Null.php


示例8: loggedIn

function loggedIn()
{
    global $app;
    if ($_COOKIE['login'] == pass($app['password']) or $app['password'] == '') {
        return true;
    } else {
        return false;
    }
}
开发者ID:sweebee,项目名称:pimatic-thermostat,代码行数:9,代码来源:functions.php


示例9: testInvalidDB

 /**
  * Github issue #458, selectDatabase causes PHP notice undefined index
  * if database key not found.
  *
  * @return void
  */
 public function testInvalidDB()
 {
     try {
         R::selectDatabase('idontexist');
         fail();
     } catch (RedException $exception) {
         pass();
     }
 }
开发者ID:gabordemooij,项目名称:redbean,代码行数:15,代码来源:Toolbox.php


示例10: enable_json_api

function enable_json_api($path)
{
    request($path, function () {
        header("Content-Type: application/json");
        header("Access-Control-Allow-Origin: *");
        header("Access-Control-Allow-Credentials: true");
        pass();
    });
}
开发者ID:necota,项目名称:pachira,代码行数:9,代码来源:json-api.php


示例11: testUTF8

 /**
  * Test UTF8 handling.
  *
  * @return void
  */
 public function testUTF8()
 {
     $str = ' 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP pass_date函数代码示例发布时间:2022-05-15
下一篇:
PHP partial_mock函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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