public function testIteratorUserDefinedAggregates()
{
// Create the UDAs (the same UDA with a different name)
$this->createUserDefinedAggregate();
$statement = new SimpleStatement("CREATE OR REPLACE AGGREGATE user_defined_aggregate_repeat(int) " . "SFUNC user_defined_function " . "STYPE int " . "FINALFUNC uda_udf_final " . "INITCOND 0");
$this->session->execute($statement);
// Validate the UDAs exists
$keyspace = $this->session->schema()->keyspace($this->keyspaceName);
$this->assertCount(2, $keyspace->aggregates());
$count = 0;
foreach ($keyspace->aggregates() as $aggregate) {
if ($aggregate->simpleName() == "user_defined_aggregate") {
$this->assertUserDefinedFunction();
$count++;
} else {
if ($aggregate->simpleName() == "user_defined_aggregate_repeat") {
$count++;
} else {
$this->fail("Invalid Aggregate Name: {$aggregate->simpleName()}");
}
}
}
$this->assertEquals(2, $count);
}