@@ -125,9 +125,6 @@ protected function assertIndex($index, $kind, $target, $className, $isCustom) {
125
125
$ this ->assertCount (1 , $ index ->options ());
126
126
$ this ->assertEquals ($ target , $ index ->option ("target " ));
127
127
}
128
-
129
- //echo "${index}" . PHP_EOL;
130
- var_dump ($ index );
131
128
}
132
129
133
130
/**
@@ -208,6 +205,7 @@ protected function assertMaterializedViewsEqual($materializedViewOne, $materiali
208
205
$ this ->assertEquals ($ materializedViewOne ->maxIndexInterval (), $ materializedViewTwo ->maxIndexInterval ());
209
206
$ this ->assertEquals ($ materializedViewOne ->minIndexInterval (), $ materializedViewTwo ->minIndexInterval ());
210
207
$ this ->assertEquals ($ materializedViewOne ->columns (), $ materializedViewTwo ->columns ());
208
+ $ this ->assertEquals ($ materializedViewOne ->partitionKey (), $ materializedViewTwo ->partitionKey ());
211
209
$ this ->assertEquals ($ materializedViewOne ->primaryKey (), $ materializedViewTwo ->primaryKey ());
212
210
$ this ->assertEquals ($ materializedViewOne ->clusteringKey (), $ materializedViewTwo ->clusteringKey ());
213
211
$ this ->assertEquals ($ materializedViewOne ->clusteringOrder (), $ materializedViewTwo ->clusteringOrder ());
@@ -221,24 +219,29 @@ protected function assertMaterializedViewsEqual($materializedViewOne, $materiali
221
219
* @param $name Name to assert
222
220
* @param $tableName Table name to assert
223
221
* @param $columns Columns names to assert
224
- * @param $primaryKeyColumns Primary key column names to assert
222
+ * @param $partitionKeyColumns Primary key column names to assert
225
223
* @param $clusteringKeyColumns Cluster key column names to assert
226
224
*/
227
- protected function assertMaterializedView ($ materializedView , $ name , $ tableName , $ columns , $ primaryKeyColumns , $ clusteringKeyColumns ) {
225
+ protected function assertMaterializedView ($ materializedView , $ name , $ tableName , $ columns , $ partitionKeyColumns , $ clusteringKeyColumns ) {
228
226
$ this ->assertEquals ($ materializedView ->name (), $ name );
229
227
$ this ->assertEquals ($ materializedView ->baseTable ()->name (), $ tableName );
230
228
$ i = 0 ;
231
229
foreach ($ materializedView ->columns () as $ column ) {
232
230
$ this ->assertEquals ($ columns [$ i ++], $ column ->name ());
233
231
}
234
232
$ i = 0 ;
235
- foreach ($ materializedView ->primaryKey () as $ column ) {
236
- $ this ->assertEquals ($ primaryKeyColumns [$ i ++], $ column ->name ());
233
+ foreach ($ materializedView ->partitionKey () as $ column ) {
234
+ $ this ->assertEquals ($ partitionKeyColumns [$ i ++], $ column ->name ());
237
235
}
238
236
$ i = 0 ;
239
237
foreach ($ materializedView ->clusteringKey () as $ column ) {
240
238
$ this ->assertEquals ($ clusteringKeyColumns [$ i ++], $ column ->name ());
241
239
}
240
+ $ primaryKeyColumns = array_merge ($ partitionKeyColumns , $ clusteringKeyColumns );
241
+ $ i = 0 ;
242
+ foreach ($ materializedView ->primaryKey () as $ column ) {
243
+ $ this ->assertEquals ($ primaryKeyColumns [$ i ++], $ column ->name ());
244
+ }
242
245
}
243
246
244
247
/**
@@ -510,15 +513,17 @@ public function testGetKeyspaceByName() {
510
513
* This test ensures that driver correctly enumerates over table and column
511
514
* metadata.
512
515
*
516
+ * @todo: Add "varchar" and "text" tests
517
+ *
513
518
* @test
514
519
*/
515
520
public function testEnumerateTablesAndColumns () {
516
521
$ keyspaceName = self ::generateKeyspaceName ("enumerate " );
517
522
518
523
$ tableSchemas = array (
519
- "table_int_varchar " => array ("key " => "int " , "value " => "varchar " ),
520
- "table_varchar_bigint " => array ("key " => "varchar " , "value " => "bigint " ),
521
- "table_varchar_map " => array ("key " => "varchar " , "value " => "map<bigint, varchar > " )
524
+ "table_int_int " => array ("key " => "int " , "value " => "int " ),
525
+ "table_int_bigint " => array ("key " => "int " , "value " => "bigint " ),
526
+ "table_decimal_map " => array ("key " => "decimal " , "value " => "map<bigint, uuid > " )
522
527
);
523
528
524
529
$ this ->createKeyspaceWithSchema ($ keyspaceName , $ tableSchemas );
@@ -542,15 +547,17 @@ public function testEnumerateTablesAndColumns() {
542
547
* This test ensures that the driver is able to access table and column
543
548
* metadata by name.
544
549
*
550
+ * @todo: Add "varchar" and "text" tests
551
+ *
545
552
* @test
546
553
*/
547
554
public function testGetTableAndColumnByName () {
548
555
$ keyspaceName = self ::generateKeyspaceName ("by_name " );
549
556
550
557
$ tableSchemas = array (
551
- "table_int_varchar " => array ("key " => "int " , "value " => "varchar " ),
552
- "table_varchar_bigint " => array ("key " => "varchar " , "value " => "bigint " ),
553
- "table_varchar_map " => array ("key " => "varchar " , "value " => "map<bigint, varchar > " )
558
+ "table_int_int " => array ("key " => "int " , "value " => "int " ),
559
+ "table_int_bigint " => array ("key " => "int " , "value " => "bigint " ),
560
+ "table_decimal_map " => array ("key " => "decimal " , "value " => "map<bigint, uuid > " )
554
561
);
555
562
556
563
$ this ->createKeyspaceWithSchema ($ keyspaceName , $ tableSchemas );
@@ -636,35 +643,37 @@ public function testSchemaMetadataWithNullFields() {
636
643
* This test ensures that the validator parser correctly parses and builds
637
644
* columns with deeply nested collection types.
638
645
*
646
+ * @todo: Add "varchar" and "text" tests
647
+ *
639
648
* @test
640
649
* @ticket PHP-62
641
650
*/
642
651
public function testSchemaMetadataWithNestedColumnTypes () {
643
652
$ statement = new SimpleStatement (
644
- "CREATE TABLE {$ this ->tableNamePrefix }_nested1 (key int PRIMARY KEY, value map<frozen<list<varchar >>, varchar >) "
653
+ "CREATE TABLE {$ this ->tableNamePrefix }_nested1 (key int PRIMARY KEY, value map<frozen<list<int >>, int >) "
645
654
);
646
655
$ this ->session ->execute ($ statement );
647
656
648
657
$ statement = new SimpleStatement (
649
- "CREATE TABLE {$ this ->tableNamePrefix }_nested2 (key int PRIMARY KEY, value map<varchar , frozen<list<varchar >>>) "
658
+ "CREATE TABLE {$ this ->tableNamePrefix }_nested2 (key int PRIMARY KEY, value map<int , frozen<list<int >>>) "
650
659
);
651
660
$ this ->session ->execute ($ statement );
652
661
653
662
$ statement = new SimpleStatement (
654
- "CREATE TABLE {$ this ->tableNamePrefix }_nested3 (key int PRIMARY KEY, value list<frozen<map<varchar , frozen<set<varchar >>>>>) "
663
+ "CREATE TABLE {$ this ->tableNamePrefix }_nested3 (key int PRIMARY KEY, value list<frozen<map<int , frozen<set<int >>>>>) "
655
664
);
656
665
$ this ->session ->execute ($ statement );
657
666
658
667
$ keyspace = $ this ->session ->schema ()->keyspace ($ this ->keyspaceName );
659
668
660
669
$ table1 = $ keyspace ->table ("{$ this ->tableNamePrefix }_nested1 " );
661
- $ this ->assertEquals ((string )$ table1 ->column ("value " )->type (), "map<list<varchar >, varchar > " );
670
+ $ this ->assertEquals ((string )$ table1 ->column ("value " )->type (), "map<list<int >, int > " );
662
671
663
672
$ table2 = $ keyspace ->table ("{$ this ->tableNamePrefix }_nested2 " );
664
- $ this ->assertEquals ((string )$ table2 ->column ("value " )->type (), "map<varchar , list<varchar >> " );
673
+ $ this ->assertEquals ((string )$ table2 ->column ("value " )->type (), "map<int , list<int >> " );
665
674
666
675
$ table3 = $ keyspace ->table ("{$ this ->tableNamePrefix }_nested3 " );
667
- $ this ->assertEquals ((string )$ table3 ->column ("value " )->type (), "list<map<varchar , set<varchar >>> " );
676
+ $ this ->assertEquals ((string )$ table3 ->column ("value " )->type (), "list<map<int , set<int >>> " );
668
677
}
669
678
670
679
/**
@@ -805,7 +814,7 @@ public function testMaterializedViews() {
805
814
$ materializedView = $ keyspace ->materializedView ("simple " );
806
815
$ this ->assertMaterializedViewsEqual ($ materializedView , $ table ->materializedView ("simple " ));
807
816
$ this ->assertMaterializedView ($ materializedView , "simple " , "{$ this ->tableNamePrefix }_1 " ,
808
- array ("value1 " , "key1 " ), array ("value1 " ), array ("key1 " ));
817
+ array ("value1 " , "key1 " ), array ("value1 " , " key1 " ), array ("key1 " ));
809
818
}
810
819
811
820
/**
0 commit comments