@@ -125,9 +125,6 @@ protected function assertIndex($index, $kind, $target, $className, $isCustom) {
125125 $ this ->assertCount (1 , $ index ->options ());
126126 $ this ->assertEquals ($ target , $ index ->option ("target " ));
127127 }
128-
129- //echo "${index}" . PHP_EOL;
130- var_dump ($ index );
131128 }
132129
133130 /**
@@ -208,6 +205,7 @@ protected function assertMaterializedViewsEqual($materializedViewOne, $materiali
208205 $ this ->assertEquals ($ materializedViewOne ->maxIndexInterval (), $ materializedViewTwo ->maxIndexInterval ());
209206 $ this ->assertEquals ($ materializedViewOne ->minIndexInterval (), $ materializedViewTwo ->minIndexInterval ());
210207 $ this ->assertEquals ($ materializedViewOne ->columns (), $ materializedViewTwo ->columns ());
208+ $ this ->assertEquals ($ materializedViewOne ->partitionKey (), $ materializedViewTwo ->partitionKey ());
211209 $ this ->assertEquals ($ materializedViewOne ->primaryKey (), $ materializedViewTwo ->primaryKey ());
212210 $ this ->assertEquals ($ materializedViewOne ->clusteringKey (), $ materializedViewTwo ->clusteringKey ());
213211 $ this ->assertEquals ($ materializedViewOne ->clusteringOrder (), $ materializedViewTwo ->clusteringOrder ());
@@ -221,24 +219,29 @@ protected function assertMaterializedViewsEqual($materializedViewOne, $materiali
221219 * @param $name Name to assert
222220 * @param $tableName Table name to assert
223221 * @param $columns Columns names to assert
224- * @param $primaryKeyColumns Primary key column names to assert
222+ * @param $partitionKeyColumns Primary key column names to assert
225223 * @param $clusteringKeyColumns Cluster key column names to assert
226224 */
227- protected function assertMaterializedView ($ materializedView , $ name , $ tableName , $ columns , $ primaryKeyColumns , $ clusteringKeyColumns ) {
225+ protected function assertMaterializedView ($ materializedView , $ name , $ tableName , $ columns , $ partitionKeyColumns , $ clusteringKeyColumns ) {
228226 $ this ->assertEquals ($ materializedView ->name (), $ name );
229227 $ this ->assertEquals ($ materializedView ->baseTable ()->name (), $ tableName );
230228 $ i = 0 ;
231229 foreach ($ materializedView ->columns () as $ column ) {
232230 $ this ->assertEquals ($ columns [$ i ++], $ column ->name ());
233231 }
234232 $ 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 ());
237235 }
238236 $ i = 0 ;
239237 foreach ($ materializedView ->clusteringKey () as $ column ) {
240238 $ this ->assertEquals ($ clusteringKeyColumns [$ i ++], $ column ->name ());
241239 }
240+ $ primaryKeyColumns = array_merge ($ partitionKeyColumns , $ clusteringKeyColumns );
241+ $ i = 0 ;
242+ foreach ($ materializedView ->primaryKey () as $ column ) {
243+ $ this ->assertEquals ($ primaryKeyColumns [$ i ++], $ column ->name ());
244+ }
242245 }
243246
244247 /**
@@ -510,15 +513,17 @@ public function testGetKeyspaceByName() {
510513 * This test ensures that driver correctly enumerates over table and column
511514 * metadata.
512515 *
516+ * @todo: Add "varchar" and "text" tests
517+ *
513518 * @test
514519 */
515520 public function testEnumerateTablesAndColumns () {
516521 $ keyspaceName = self ::generateKeyspaceName ("enumerate " );
517522
518523 $ 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 > " )
522527 );
523528
524529 $ this ->createKeyspaceWithSchema ($ keyspaceName , $ tableSchemas );
@@ -542,15 +547,17 @@ public function testEnumerateTablesAndColumns() {
542547 * This test ensures that the driver is able to access table and column
543548 * metadata by name.
544549 *
550+ * @todo: Add "varchar" and "text" tests
551+ *
545552 * @test
546553 */
547554 public function testGetTableAndColumnByName () {
548555 $ keyspaceName = self ::generateKeyspaceName ("by_name " );
549556
550557 $ 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 > " )
554561 );
555562
556563 $ this ->createKeyspaceWithSchema ($ keyspaceName , $ tableSchemas );
@@ -636,35 +643,37 @@ public function testSchemaMetadataWithNullFields() {
636643 * This test ensures that the validator parser correctly parses and builds
637644 * columns with deeply nested collection types.
638645 *
646+ * @todo: Add "varchar" and "text" tests
647+ *
639648 * @test
640649 * @ticket PHP-62
641650 */
642651 public function testSchemaMetadataWithNestedColumnTypes () {
643652 $ 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 >) "
645654 );
646655 $ this ->session ->execute ($ statement );
647656
648657 $ 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 >>>) "
650659 );
651660 $ this ->session ->execute ($ statement );
652661
653662 $ 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 >>>>>) "
655664 );
656665 $ this ->session ->execute ($ statement );
657666
658667 $ keyspace = $ this ->session ->schema ()->keyspace ($ this ->keyspaceName );
659668
660669 $ 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 > " );
662671
663672 $ 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 >> " );
665674
666675 $ 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 >>> " );
668677 }
669678
670679 /**
@@ -805,7 +814,7 @@ public function testMaterializedViews() {
805814 $ materializedView = $ keyspace ->materializedView ("simple " );
806815 $ this ->assertMaterializedViewsEqual ($ materializedView , $ table ->materializedView ("simple " ));
807816 $ this ->assertMaterializedView ($ materializedView , "simple " , "{$ this ->tableNamePrefix }_1 " ,
808- array ("value1 " , "key1 " ), array ("value1 " ), array ("key1 " ));
817+ array ("value1 " , "key1 " ), array ("value1 " , " key1 " ), array ("key1 " ));
809818 }
810819
811820 /**
0 commit comments