public function testDelete() { $user = new User(); $user->name = 'John'; $user->save(); $sql = 'SELECT COUNT(*) FROM user'; $this->assertEquals('1', $this->orm->execute($sql)->fetchColumn()); $user->delete(); $this->assertEquals('0', $this->orm->execute($sql)->fetchColumn()); }
public function testUpdate() { $user = new User(); $user->name = 'John'; $user->save(); $user->id = null; $user->name = 'Jane'; $user->save(); $user->id = null; $user->name = 'Mark'; $user->save(); $fluentUser = new FluentUser(); $fluentUser->name = 'oops'; $fluentUser->updateAll(); $names = $this->orm->execute('SELECT name FROM user')->fetchAll(\PDO::FETCH_COLUMN); foreach ($names as $name) { $this->assertEquals('oops', $name); } }