Exemplo n.º 1
0
 public function testGettingAvgItemsFromCollection()
 {
     $c = new Collection([(object) ['foo' => 10], (object) ['foo' => 20]]);
     $this->assertEquals(15, $c->avg('foo'));
     $c = new Collection([['foo' => 10], ['foo' => 20]]);
     $this->assertEquals(15, $c->avg('foo'));
     $c = new Collection([1, 2, 3, 4, 5]);
     $this->assertEquals(3, $c->avg());
     $c = new Collection();
     $this->assertNull($c->avg());
 }