public function testAvgEmpty() { $collection = new Collection(); $avg = $collection->avg('id'); //Assertions $this->assertEquals(null, $avg); }
/** * @expectedException Mookofe\LaravelSupport\Exceptions\AttributeNotFoundException */ public function testCompareInvalidAttribute() { $compare_collection = new Collection(); //Add an empty model $model = new Model(); $compare_collection->add($model); //Check if all users have a record on the user avatar collection $this->assertTrue($this->collection->compare($compare_collection, 'invalid_field', 'id')); }
public function testSumValues() { $collection = new Collection(); //Add fake items to collection $model1 = Mockery::mock('Mookofe\\LaravelSupport\\Model'); $model2 = Mockery::mock('Mookofe\\LaravelSupport\\Model'); $model1->shouldReceive('delete')->once()->andReturn(null); $model2->shouldReceive('delete')->once()->andReturn(null); $collection->add($model1); $collection->add($model2); //Delete items $collection->delete(); }