Esempio n. 1
0
 /**
  * @dataProvider dateTimes
  */
 public function testAggregateValues(\Pinq\ITraversable $traversable, array $data)
 {
     $this->assertEquals(true, $traversable->all(), 'All');
     $this->assertEquals(true, $traversable->any(), 'Any');
     $this->assertEquals(max($data), $traversable->maximum(), 'Max');
     $this->assertEquals(min($data), $traversable->minimum(), 'Min');
 }
Esempio n. 2
0
 /**
  * @dataProvider someStrings
  */
 public function testAggregateValuesString(\Pinq\ITraversable $traversable, array $data)
 {
     $this->assertEquals(true, $traversable->all(), 'All');
     $this->assertEquals(true, $traversable->any(), 'Any');
     $this->assertEquals(array_sum(array_map('strlen', $data)) / count($data), $traversable->average('strlen'), 'Average string length');
     $this->assertEquals(array_sum(array_map('strlen', $data)), $traversable->sum('strlen'), 'Sum string length');
     $this->assertEquals(array_unique($data), $traversable->unique()->asArray(), 'Unique');
     $this->assertEquals(implode('- -- -', $data), $traversable->implode('- -- -'), 'String implode');
 }
Esempio n. 3
0
 public function visitAny(Requests\Any $request)
 {
     return $this->traversable->any($this->getOptionalFunction($request));
 }
Esempio n. 4
0
 /**
  * @dataProvider everything
  */
 public function testThatAnyOperatesCorrectly(\Pinq\ITraversable $traversable, array $data)
 {
     $this->assertSame(count(array_filter($data)) > 0, $traversable->any());
 }