/** * @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'); }
/** * @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'); }
public function visitAny(Requests\Any $request) { return $this->traversable->any($this->getOptionalFunction($request)); }
/** * @dataProvider everything */ public function testThatAnyOperatesCorrectly(\Pinq\ITraversable $traversable, array $data) { $this->assertSame(count(array_filter($data)) > 0, $traversable->any()); }