예제 #1
0
 /**
  * Tests the last() method when on an empty collection
  *
  * @return void
  */
 public function testLAstWithEmptyCollection()
 {
     $collection = new Collection([]);
     $this->assertNull($collection->last());
 }
예제 #2
0
 /**
  * Tests the last() method
  *
  * @return void
  */
 public function testLast()
 {
     $collection = new Collection([1, 2, 3]);
     $this->assertEquals(3, $collection->last());
     $collection = $collection->map(function ($e) {
         return $e * 2;
     });
     $this->assertEquals(6, $collection->last());
 }