/** * Test the setting of the Request on init of the model * * @covers \MasheryApi\Model::__construct * @covers \MasheryApi\Model::setRequest */ public function testSetRequestOnConstruct() { $request = new \MasheryApi\Request(); $model = new \MockModel($request); $this->assertNotNull($model->getRequest()); $this->assertTrue($model->getRequest() instanceof \MasheryApi\Request); }
public function fetch($row) { return MockModel::fetch($row, 'MockModel'); }
public function testBatchSave() { $nathan = new MockModel('nathan', null, '*****@*****.**'); $nathan->shadowProperty = 'Some Value'; $nathan->someRandomValue = 2; $nele = new MockModel('nele', null, '*****@*****.**'); $nele->shadowProperty = 'Some Value'; try { DBModel::batchSave(array($nathan, $nele)); $this->fail('Exception expected'); } catch (ValidationException $e) { $this->assertEquals('Integer is required', $nele->someRandomValue_error); $this->assertNull(MockModel::getByName('nathan')); } $nele->someRandomValue = 3; DBModel::batchSave(array($nathan, $nele)); $this->assertNotNull(MockModel::getByName('nathan')); $this->assertNotNull(MockModel::getByName('nele')); }