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


PHP Author::count方法代码示例

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


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

示例1: testGh149EmptyCount

 public function testGh149EmptyCount()
 {
     $total = Author::count();
     $this->assertEquals($total, Author::count(null));
     $this->assertEquals($total, Author::count(array()));
 }
开发者ID:ruri,项目名称:php-activerecord-camelcased,代码行数:6,代码来源:ActiveRecordFindTest.php

示例2: test_count

 public function test_count()
 {
     $this->assert_equals(1, Author::count(1));
     $this->assert_equals(2, Author::count(array(1, 2)));
     $this->assert_true(Author::count() > 1);
     $this->assert_equals(0, Author::count(array('conditions' => 'author_id=99999999999999')));
     $this->assert_equals(2, Author::count(array('conditions' => 'author_id=1 or author_id=2')));
     $this->assert_equals(1, Author::count(array('name' => 'Tito', 'author_id' => 1)));
 }
开发者ID:scorplev,项目名称:php-activerecord,代码行数:9,代码来源:ActiveRecordFindTest.php

示例3: test_gh149_empty_count

 public function test_gh149_empty_count()
 {
     $total = Author::count();
     $this->assert_equals($total, Author::count(null));
     $this->assert_equals($total, Author::count(array()));
 }
开发者ID:visavi,项目名称:phpactiverecord,代码行数:6,代码来源:ActiveRecordFindTest.php

示例4: test_transaction_rolledback_by_throwing_exception

 public function test_transaction_rolledback_by_throwing_exception()
 {
     $original = Author::count();
     $exception = null;
     try {
         Author::transaction(function () {
             Author::create(array("name" => "blah"));
             throw new Exception("blah");
         });
     } catch (Exception $e) {
         $exception = $e;
     }
     $this->assert_not_null($exception);
     $this->assert_equals($original, Author::count());
 }
开发者ID:sebcode,项目名称:php-activerecord,代码行数:15,代码来源:ActiveRecordTest.php

示例5: testTransactionRolledbackByThrowingException

 public function testTransactionRolledbackByThrowingException()
 {
     $original = Author::count();
     $exception = null;
     try {
         Author::transaction(function () {
             Author::create(array("name" => "blah"));
             throw new Exception("blah");
         });
     } catch (Exception $e) {
         $exception = $e;
     }
     $this->assertNotNull($exception);
     $this->assertEquals($original, Author::count());
 }
开发者ID:ruri,项目名称:php-activerecord-camelcased,代码行数:15,代码来源:ActiveRecordTest.php


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