Skip to content

Commit 143572d

Browse files
Michael Ferompenick
authored andcommitted
test: Correcting data type providers to work with duration
1 parent 6c75d02 commit 143572d

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

tests/integration/Cassandra/MapIntegrationTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ public function testScalarTypes($type, $value) {
3838
* Data provider for maps with scalar types
3939
*/
4040
public function mapWithScalarTypes() {
41+
// Ensure duration data type is not used as a key for set
42+
$scalarCassandraTypes = array_filter($this->scalarCassandraTypes(),
43+
function($cassandraType) {
44+
if ($cassandraType[0] != "duration") {
45+
return $cassandraType;
46+
}
47+
}
48+
);
49+
4150
$mapKeyTypes = array_map(function ($cassandraType) {
4251
$mapType = Type::map($cassandraType[0], Type::int());
4352
$values = $cassandraType[1];
@@ -46,7 +55,7 @@ public function mapWithScalarTypes() {
4655
$map->set($values[$i], $i);
4756
}
4857
return array($mapType, $map);
49-
}, $this->scalarCassandraTypes());
58+
}, $scalarCassandraTypes);
5059

5160
$mapValueTypes = array_map(function ($cassandraType) {
5261
$mapType = Type::map(Type::int(), $cassandraType[0]);

tests/integration/Cassandra/SetIntegrationTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,23 @@ public function testScalarTypes($type, $value) {
3838
* Data provider for sets with scalar types
3939
*/
4040
public function setWithScalarTypes() {
41+
// Ensure duration data type is not used as a key for set
42+
$scalarCassandraTypes = array_filter($this->scalarCassandraTypes(),
43+
function($cassandraType) {
44+
if ($cassandraType[0] != "duration") {
45+
return $cassandraType;
46+
}
47+
}
48+
);
49+
4150
return array_map(function ($cassandraType) {
4251
$setType = Type::set($cassandraType[0]);
4352
$set = $setType->create();
4453
foreach ($cassandraType[1] as $value) {
4554
$set->add($value);
4655
}
4756
return array($setType, $set);
48-
}, $this->scalarCassandraTypes());
57+
}, $scalarCassandraTypes);
4958
}
5059

5160
/**

0 commit comments

Comments
 (0)