Beispiel #1
0
 public function testExists()
 {
     $this->assertFalse(Person::exists(12345678));
     $p = new Person();
     $p->name = "Jimmy Page";
     $p->insert();
     $actual = Person::exists($p->id);
     $this->assertTrue($actual);
 }
Beispiel #2
0
 public function testPreparedExecuteTransaction()
 {
     $person = new Person();
     $person->name = 'Janick Gers';
     $person->income = 100;
     $person->insert();
     $id = $person->id;
     $conn = DB::getConnection('testdb');
     DB::begin();
     $conn->preparedExecute("UPDATE person SET income = ?", array(200));
     DB::rollback();
     $this->assertEquals(100, Person::get($id)->income);
     DB::begin();
     $conn->preparedExecute("UPDATE person SET income = ?", array(200));
     DB::commit();
     $this->assertEquals(200, Person::get($id)->income);
 }