/**
  * @test
  */
 public function selectが条件に一致する要素数を返す()
 {
     $collection = new Collection([1, 2, 3]);
     $result = $collection->select(function ($data) {
         return $data === 2;
     })->all();
     $this->assertEquals(1, count($result));
 }
 /**
  * @test
  */
 public function 連想配列のキーがfooの要素だけを返す()
 {
     $data = ['foo' => 1, 'bar' => 2];
     $expected = ['foo' => 1];
     $collect = new Collection($data);
     $actual = $collect->select(function ($key) {
         return $key === 'foo';
     }, ARRAY_FILTER_USE_KEY)->all();
     $this->assertSame($expected, $actual);
 }