當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。