public function testInsert() { $foo = new \Sandbox\Model\String($this->db); $foo['name'] = 'Foo'; $foo->save(); $this->assertSame('Foo', $foo['name']); }
public function testInflateUsingPrimaryKey() { $foo = new \Sandbox\Model\String($this->db); $foo->save(); $properties = $foo->getData(); $foo = new \Sandbox\Model\String($this->db, $foo['id']); $this->assertSame($properties, $foo->getData()); }
public function testGetAllPropertiesOfExistingObject() { $foo = new \Sandbox\Model\String($this->db); $foo->save(); $data = ['id' => null, 'name' => '']; $data['id'] = $foo['id']; $properties = $foo->getData(); $this->assertSame($data, $properties); }
public function testDeleteExistingObject() { $foo = new \Sandbox\Model\String($this->db); $foo['name'] = 'foo'; $foo->save(); $this->assertArrayHasKey('id', $foo); $foo->delete(); $this->assertArrayNotHasKey('id', $foo); }
public function testDoNotUpdateIfValueHasNotChanged() { $foo = new \Sandbox\Model\String($this->db); $foo['name'] = 'foo'; $foo->save(); $synchronisation_count = $foo->getSynchronisationCount(); $foo->save(); $this->assertSame($synchronisation_count, $foo->getSynchronisationCount()); }
/** * @todo Check if object's state is recovered. * * @expectedException Gajus\MOA\Exception\LogicException * @expectedExceptionMessage Transaction was commited before the time. */ public function testAfterDeleteCannotCommitTransaction() { $foo = new \Sandbox\Model\String($this->db); $foo['name'] = 'delete_commit_transaction'; $foo->save(); $foo->delete(); }
public function testGetDatabaseHandle() { $foo = new \Sandbox\Model\String($this->db); $this->assertSame($this->db, $foo->getDatabaseHandle()); }
/** * @expectedException Gajus\MOA\Exception\ValidationException * @expectedExceptionMessage save_does_not_pass */ public function testSaveValidationDoesNotPass() { $foo = new \Sandbox\Model\String($this->db); $foo['name'] = 'save_do_not_pass'; $foo->save(); }
/** * @expectedException Gajus\MOA\Exception\InvalidArgumentException * @expectedExceptionMessage Name is not a string. */ public function testSetNameNotString() { $foo = new \Sandbox\Model\String($this->db); $foo->set([], 'bar'); }