Author: Erik Galloway (erik@mybarnapp.com)
Inheritance: implements EGALL\Transformer\Contracts\Transformable
Esempio n. 1
0
 /**
  * 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);
 }
Esempio n. 2
0
	public function fetch($row)
	{
		return MockModel::fetch($row, 'MockModel');
	}
Esempio n. 3
0
	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'));
	}