public function testGh149EmptyCount() { $total = Author::count(); $this->assertEquals($total, Author::count(null)); $this->assertEquals($total, Author::count(array())); }
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))); }
public function test_gh149_empty_count() { $total = Author::count(); $this->assert_equals($total, Author::count(null)); $this->assert_equals($total, Author::count(array())); }
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()); }
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()); }