/** * @depends testSetConnectionError */ public function testDisconnect() { $this->assertTrue(DB::isConnected('foo')); DB::disconnect('foo'); $this->assertFalse(DB::isConnected('foo')); DB::disconnect('foo'); $this->assertFalse(DB::isConnected('foo')); }
public function testDisconnectRollsBackTransaction() { $person = new Person(); $person->name = 'Nicko McBrain'; $person->income = 12345; $person->save(); $id = $person->id; DB::begin(); $p = Person::get($id); $p->income = 54321; $p->save(); // This should roll back changes DB::disconnect('testdb'); // So they won't be commited here DB::commit(); $this->assertEquals(12345, Person::get($id)->income); }