当前位置: 首页>>代码示例>>PHP>>正文


PHP Test::findAll方法代码示例

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


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

示例1: testRowMethods

 function testRowMethods()
 {
     $id = $this->addRow();
     $tr = new Test();
     $loaded = $tr->load($id);
     $this->assert($updatedRow = $loaded, "Test->load() failed: " . var_export($loaded, 1));
     $exp = $tr->export();
     $this->assert($updatedRow = $exp, "Test->export() failed: " . var_export($exp, 1));
     $newname = 'test updated again';
     $tr->name = $newname;
     $save = $tr->save();
     $this->assert($save, "Test->save() failed: " . var_export($tr->getErrorList(), 1));
     $this->assert(Test::count() == 1, "Test::count() failed");
     $tr->name = null;
     $this->assert(!$tr->save(), "Test->save() should have failed (required name rule should fail)!");
     $tr->name = array('123');
     $this->assert(!$tr->save(), "Test->save() should have failed (string name rule should fail)!");
     $tr2 = new Test();
     $tr2->name = '000 second row';
     // three zeroes - to ensure it sorts above the first one
     $this->assert($tr2->save(), 'Test->save() failed: ' . var_export($tr->getErrorList(), 1));
     $s = Test::findAll();
     $s->setOrder('name');
     $s->paginate(1, 1);
     $all = $s->export()->fetchAll();
     $this->assert(1 == count($all), 'Select->count() failed after pagination');
     $this->assert($tr2->name == $all[0]->name, 'Select->export() failed ordering');
 }
开发者ID:nakonechny,项目名称:naf,代码行数:28,代码来源:ActiveRecordTest.php

示例2: actionIndex

 function actionIndex()
 {
     $objects = Test::findAll();
     $this->render('index', array('data' => $objects));
 }
开发者ID:angelog,项目名称:nin,代码行数:5,代码来源:index.php


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