diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php index 007c1a3eb1..2c8148f762 100644 --- a/libraries/insert_edit.lib.php +++ b/libraries/insert_edit.lib.php @@ -21,8 +21,9 @@ if (! defined('PHPMYADMIN')) { * * @return array $_form_params array of insert/edit form parameters */ -function PMA_getFormParametersForInsertForm($db, $table, $where_clauses, $where_clause_array, $err_url) -{ +function PMA_getFormParametersForInsertForm( + $db, $table, $where_clauses, $where_clause_array, $err_url +) { $_form_params = array( 'db' => $db, 'table' => $table, @@ -48,8 +49,8 @@ function PMA_getFormParametersForInsertForm($db, $table, $where_clauses, $where_ * @param type $table name of the table * @param type $db name of the database * - * @return type containing insert_mode,whereClauses, result array - * where_clauses_array and found_unique_key boolean value + * @return type containing insert_mode,whereClauses, result array + * where_clauses_array and found_unique_key boolean value */ function PMA_getValuesForEditMode($where_clause, $table, $db) { @@ -57,8 +58,14 @@ function PMA_getValuesForEditMode($where_clause, $table, $db) if (isset($where_clause)) { $where_clause_array = PMA_getWhereClauseArray($where_clause); list($whereClauses, $resultArray, $rowsArray, $found_unique_key) - = PMA_analyzeWhereClauses($where_clause_array, $table, $db, $found_unique_key); - return array(false, $whereClauses, $resultArray, $rowsArray, $where_clause_array, $found_unique_key); + = PMA_analyzeWhereClauses( + $where_clause_array, $table, $db, $found_unique_key + ); + return array( + false, $whereClauses, + $resultArray, $rowsArray, + $where_clause_array, $found_unique_key + ); } else { list($results, $row) = PMA_loadFirstRowInEditMode($table, $db); return array(true, null, $results, $row, null, $found_unique_key); @@ -90,19 +97,24 @@ function PMA_getWhereClauseArray($where_clause) * * @return array $where_clauses, $result, $rows */ -function PMA_analyzeWhereClauses($where_clause_array, $table, $db, $found_unique_key) -{ +function PMA_analyzeWhereClauses(\ + $where_clause_array, $table, $db, $found_unique_key +) { $rows = array(); $result = array(); $where_clauses = array(); foreach ($where_clause_array as $key_id => $where_clause) { - $local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) - . ' WHERE ' . $where_clause . ';'; - $result[$key_id] = PMA_DBI_query($local_query, null, PMA_DBI_QUERY_STORE); - $rows[$key_id] = PMA_DBI_fetch_assoc($result[$key_id]); + $local_query = 'SELECT * FROM ' + . PMA_backquote($db) . '.' . PMA_backquote($table) + . ' WHERE ' . $where_clause . ';'; + $result[$key_id] = PMA_DBI_query($local_query, null, PMA_DBI_QUERY_STORE); + $rows[$key_id] = PMA_DBI_fetch_assoc($result[$key_id]); $where_clauses[$key_id] = str_replace('\\', '\\\\', $where_clause); - $found_unique_key = PMA_showEmptyResultMessageOrSetUniqueCondition($rows, $key_id, - $where_clause_array, $local_query, $result, $found_unique_key); + $found_unique_key = PMA_showEmptyResultMessageOrSetUniqueCondition( + $rows, $key_id, + $where_clause_array, $local_query, + $result, $found_unique_key + ); } return array($where_clauses, $result, $rows, $found_unique_key); } @@ -125,12 +137,16 @@ function PMA_showEmptyResultMessageOrSetUniqueCondition($rows, $key_id, // No row returned if (! $rows[$key_id]) { unset($rows[$key_id], $where_clause_array[$key_id]); - PMA_showMessage(__('MySQL returned an empty result set (i.e. zero rows).'), $local_query); + PMA_showMessage( + __('MySQL returned an empty result set (i.e. zero rows).'), + $local_query + ); exit; } else {// end if (no row returned) $meta = PMA_DBI_get_fields_meta($result[$key_id]); - list($unique_condition, $tmp_clause_is_unique) - = PMA_getUniqueCondition($result[$key_id], count($meta), $meta, $rows[$key_id], true); + list($unique_condition, $tmp_clause_is_unique) = PMA_getUniqueCondition( + $result[$key_id], count($meta), $meta, $rows[$key_id], true + ); if (! empty($unique_condition)) { $found_unique_key = true; } @@ -192,13 +208,21 @@ function PMA_showFunctionFieldsInEditMode($url_params, $showFuncFields) } else { $params['ShowFunctionFields'] = 0; } - $params['ShowFieldTypesInDataEditView'] = $GLOBALS['cfg']['ShowFieldTypesInDataEditView']; + $params['ShowFieldTypesInDataEditView'] + = $GLOBALS['cfg']['ShowFieldTypesInDataEditView']; $params['goto'] = 'sql.php'; $this_url_params = array_merge($url_params, $params); if (! $showFuncFields) { - return ' : ' . __('Function') . '' . "\n"; + return ' : ' + . __('Function') + . '' . "\n"; } - return ' ' . __('Function') . '' . "\n"; + return '' + . __('Function') + . '' . "\n"; } /** @@ -220,9 +244,12 @@ function PMA_showColumnTypesInDataEditView($url_params, $showColumnType ) $params['goto'] = 'sql.php'; $this_other_url_params = array_merge($url_params, $params); if (! $showColumnType) { - return ' : ' . __('Type') . '' . "\n"; + return ' : ' + . __('Type') . '' . "\n"; } - return ' ' . __('Type') . '' . "\n"; } @@ -243,9 +270,11 @@ function PMA_getDefaultForDatetime($column) // Note: (tested in MySQL 4.0.16): when lang is some UTF-8, // $column['Default'] is not set if it contains NULL: - // Array ([Field] => d [Type] => datetime [Null] => YES [Key] => [Extra] => [True_Type] => datetime) + // Array ([Field] => d [Type] => datetime [Null] => YES [Key] => + // [Extra] => [True_Type] => datetime) // but, look what we get if we switch to iso: (Default is NULL) - // Array ([Field] => d [Type] => datetime [Null] => YES [Key] => [Default] => [Extra] => [True_Type] => datetime) + // Array ([Field] => d [Type] => datetime [Null] => YES [Key] => + // [Default] => [Extra] => [True_Type] => datetime) // so I force a NULL into it (I don't think it's possible // to have an empty default value for DATETIME) // then, the "if" after this one will work @@ -255,7 +284,7 @@ function PMA_getDefaultForDatetime($column) && $column['Null'] == 'YES' ) { $column['Default'] = null; - } + } } /** @@ -274,7 +303,7 @@ function PMA_analyzeTableColumnsArray($column, $comments_map, $timestamp_seen) // True_Type contains only the type (stops at first bracket) $column['True_Type'] = preg_replace('@\(.*@s', '', $column['Type']); PMA_getDefaultForDatetime($column); - $column['len'] = preg_match('@float|double@', $column['Type']) ? 100 : -1; + $column['len'] = preg_match('@float|double@', $column['Type']) ? 100 : -1; $column['Field_title'] = PMA_getColumnTitle($column, $comments_map); $column['is_binary'] = PMA_isColumnBinary($column); $column['is_blob'] = PMA_isColumnBlob($column); @@ -307,10 +336,11 @@ function PMA_getColumnTitle($column, $comments_map) /** * check whether the column is a bainary * - * @param array $column description of column in given table + * @param array $column description of column in given table * - * @return boolean If check to ensure types such as "enum('one','two','binary',..)" or - * "enum('one','two','varbinary',..)" are not categorized as binary. + * @return boolean If check to ensure types such as "enum('one','two','binary',..)" + * or "enum('one','two','varbinary',..)" are not categorized as + * binary. */ function PMA_isColumnBinary($column) { @@ -329,10 +359,11 @@ function PMA_isColumnBinary($column) /** * check whether the column is a blob * - * @param array $column description of column in given table + * @param array $column description of column in given table * - * @return boolean If check to ensure types such as "enum('one','two','blob',..)" or - * "enum('one','two','tinyblob',..)" etc. are not categorized as blob. + * @return boolean If check to ensure types such as "enum('one','two','blob',..)" + * or "enum('one','two','tinyblob',..)" etc. are not categorized + * as blob. */ function PMA_isColumnBlob($column) { @@ -350,10 +381,10 @@ function PMA_isColumnBlob($column) /** * check is table column char * - * @param array $column description of column in given table + * @param array $column description of column in given table * - * @return boolean If check to ensure types such as "enum('one','two','char',..)" or - * "enum('one','two','varchar',..)" are not categorized as char. + * @return boolean If check to ensure types such as "enum('one','two','char',..)" or + * "enum('one','two','varchar',..)" are not categorized as char. */ function PMA_isColumnChar($column) { @@ -368,10 +399,10 @@ function PMA_isColumnChar($column) /** * Retieve set, enum, timestamp table columns * - * @param array $column description of column in given table - * @param int $timestamp_seen 0 interger + * @param array $column description of column in given table + * @param integer $timestamp_seen 0 interger * - * return array $column['pma_type'], $column['wrap'], $column['first_timestamp'] + * return array $column['pma_type'], $column['wrap'], $column['first_timestamp'] */ function PMA_getEnumSetAndTimestampColumns($column, $timestamp_seen) { @@ -408,15 +439,16 @@ function PMA_getEnumSetAndTimestampColumns($column, $timestamp_seen) * Note: from the MySQL manual: "BINARY doesn't affect how the column is * stored or retrieved" so it does not mean that the contents is binary * - * @param array $column description of column in given table - * @param boolean $is_upload upload or no - * @param string $column_name_appendix the name atttibute - * @param string $unnullify_trigger validation string - * @param array $no_support_types list of datatypes that are not (yet) handled by PMA - * @param integer $tabindex_for_function +3000 - * @param integer $tabindex tab index - * @param integer $idindex id index - * @param boolean $insert_mode insert mode or edit mode + * @param array $column description of column in given table + * @param boolean $is_upload upload or no + * @param string $column_name_appendix the name atttibute + * @param string $unnullify_trigger validation string + * @param array $no_support_types list of datatypes that are not (yet) + * handled by PMA + * @param integer $tabindex_for_function +3000 + * @param integer $tabindex tab index + * @param integer $idindex id index + * @param boolean $insert_mode insert mode or edit mode * * @return string an html sippet */ @@ -429,7 +461,7 @@ function PMA_getFunctionColumn($column, $is_upload, $column_name_appendix, || ($GLOBALS['cfg']['ProtectBinary'] == 'all' && $column['is_binary']) || ($GLOBALS['cfg']['ProtectBinary'] == 'noblob' && !$column['is_blob']) ) { - $html_output .= ' ' . __('Binary') . '' . "\n"; + $html_output .= '' . __('Binary') . '' . "\n"; } elseif (strstr($column['True_Type'], 'enum') || strstr($column['True_Type'], 'set') || in_array($column['pma_type'], $no_support_types) @@ -437,8 +469,10 @@ function PMA_getFunctionColumn($column, $is_upload, $column_name_appendix, $html_output .= ' --' . "\n"; } else { $html_output .= '' . "\n"; - $html_output .= ''; $html_output .= PMA_getFunctionsForField($column, $insert_mode) . "\n"; $html_output .= '' . "\n"; $html_output .= '' . "\n"; @@ -449,48 +483,49 @@ function PMA_getFunctionColumn($column, $is_upload, $column_name_appendix, /** * The null column * - * @param array $column description of column in given table - * @param string $column_name_appendix the name atttibute - * @param array $real_null_value is column value null or not null + * @param array $column description of column in given table + * @param string $column_name_appendix the name atttibute + * @param array $real_null_value is column value null or not null * @param integer $tabindex tab index * @param integer $tabindex_for_null +6000 * @param integer $idindex id index - * @param array $vkey [multi_edit]['row_id'] - * @param array $foreigners keys into foreign fields - * @param array $foreignData data about the foreign keys + * @param array $vkey [multi_edit]['row_id'] + * @param array $foreigners keys into foreign fields + * @param array $foreignData data about the foreign keys * * @return string an html snippet */ function PMA_getNullColumn($column, $column_name_appendix, $real_null_value, $tabindex, $tabindex_for_null, $idindex, $vkey, $foreigners, $foreignData ) { - $html_output = ''; - $html_output .= ' ' . "\n"; - if ($column['Null'] == 'YES') { - $html_output .= ' '; - - // nullify_code is needed by the js nullify() function - $nullify_code = PMA_getNullifyCodeForNullColumn($column, $foreigners, $foreignData); - // to be able to generate calls to nullify() in jQuery - $html_output .= ''; - $html_output .= ''; - $html_output .= ''; + if ($column['Null'] != 'YES') { + return "\n"; } - $html_output .= ' ' . "\n"; + $html_output = ''; + $html_output .= '' . "\n"; + $html_output .= ''; + + // nullify_code is needed by the js nullify() function + $nullify_code = PMA_getNullifyCodeForNullColumn($column, $foreigners, $foreignData); + // to be able to generate calls to nullify() in jQuery + $html_output .= ''; + $html_output .= ''; + $html_output .= ''; + $html_output .= '' . "\n"; return $html_output; } @@ -498,9 +533,9 @@ function PMA_getNullColumn($column, $column_name_appendix, $real_null_value, /** * Retrieve the nullify code for the null column * - * @param array $column description of column in given table - * @param array $foreigners keys into foreign fields - * @param array $foreignData data about the foreign keys + * @param array $column description of column in given table + * @param array $foreigners keys into foreign fields + * @param array $foreignData data about the foreign keys * * @return integer $nullify_code */ @@ -529,85 +564,106 @@ function PMA_getNullifyCodeForNullColumn($column, $foreigners, $foreignData) /** * Get the HTML elements for value column in inert form * - * @param array $column description of column in given table - * @param string $backup_field hidden input field - * @param string $column_name_appendix the name atttibute - * @param string $unnullify_trigger validation string - * @param integer $tabindex tab index - * @param integer $tabindex_for_value offset for the values tabindex - * @param integer $idindex id index - * @param array $data description of the column field - * @param array $special_chars special characters - * @param array $foreignData data about the foreign keys - * @param array $paramTableDbArray array containing $db and $table - * @param array $rownumber_param &rownumber=row_id - * @param array $titles An HTML IMG tag for a particular icon from a theme, - * which may be an actual file or an icon from a sprite - * @param array $text_dir - * @param string $special_chars_encoded replaced char if the string starts - * with a \r\n pair (0x0d0a) add an extra \n - * @param integer $biggest_max_file_size 0 intger - * @param string $default_char_editing default char editing mode which is stroe - * in the config.inc.php script - * @param array $no_support_types list of datatypes that are not (yet) handled by PMA - * @param array $gis_data_types list of GIS data types + * @param array $column description of column in given table + * @param string $backup_field hidden input field + * @param string $column_name_appendix the name atttibute + * @param string $unnullify_trigger validation string + * @param integer $tabindex tab index + * @param integer $tabindex_for_value offset for the values tabindex + * @param integer $idindex id index + * @param array $data description of the column field + * @param array $special_chars special characters + * @param array $foreignData data about the foreign keys + * @param array $paramTableDbArray array containing $db and $table + * @param array $rownumber_param &rownumber=row_id + * @param array $titles An HTML IMG tag for a particular icon from + * a theme, which may be an actual file or + * an icon from a sprite + * @param array $text_dir + * @param string $special_chars_encoded replaced char if the string starts + * with a \r\n pair (0x0d0a) add an extra \n + * @param integer $biggest_max_file_size 0 intger + * @param string $default_char_editing default char editing mode which is stroe + * in the config.inc.php script + * @param array $no_support_types list of datatypes that are not (yet) + * handled by PMA + * @param array $gis_data_types list of GIS data types * - * @return string an html snippet + * @return string an html snippet */ function PMA_getValueColumn($column, $backup_field, $column_name_appendix, - $unnullify_trigger,$tabindex, $tabindex_for_value, $idindex, $data, - $special_chars, $foreignData, $odd_row, $paramTableDbArray,$rownumber_param, - $titles, $text_dir, $special_chars_encoded, $vkey,$is_upload,$biggest_max_file_size, + $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $data, + $special_chars, $foreignData, $odd_row, $paramTableDbArray, $rownumber_param, + $titles, $text_dir, $special_chars_encoded, $vkey, + $is_upload, $biggest_max_file_size, $default_char_editing, $no_support_types, $gis_data_types, $extracted_columnspec ) { $html_output = ''; if ($foreignData['foreign_link'] == true) { - $html_output .= PMA_getForeignLink($column, $backup_field, $column_name_appendix, + $html_output .= PMA_getForeignLink( + $column, $backup_field, $column_name_appendix, $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $data, $paramTableDbArray, $rownumber_param, $titles ); } elseif (is_array($foreignData['disp_row'])) { - $html_output .= PMA_dispRowForeignData($backup_field, $column_name_appendix, - $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $data, $foreignData - ); + $html_output .= PMA_dispRowForeignData( + $backup_field, $column_name_appendix, + $unnullify_trigger, $tabindex, $tabindex_for_value, + $idindex, $data, $foreignData + ); } elseif ($GLOBALS['cfg']['LongtextDoubleTextarea'] && strstr($column['pma_type'], 'longtext')) { $html_output = ' '; $html_output .= ''; $html_output .= '' . ''; - $html_output .= PMA_getTextarea($column,$backup_field, $column_name_appendix, $unnullify_trigger, - $tabindex, $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded - ); + $html_output .= PMA_getTextarea( + $column,$backup_field, $column_name_appendix, $unnullify_trigger, + $tabindex, $tabindex_for_value, $idindex, $text_dir, + $special_chars_encoded + ); } elseif (strstr($column['pma_type'], 'text')) { - $html_output .= PMA_getTextarea($column,$backup_field, $column_name_appendix, $unnullify_trigger, - $tabindex, $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded - ); + $html_output .= PMA_getTextarea( + $column, $backup_field, $column_name_appendix, $unnullify_trigger, + $tabindex, $tabindex_for_value, $idindex, $text_dir, + $special_chars_encoded + ); $html_output .= "\n"; if (strlen($special_chars) > 32000) { - $html_output .= " \n"; - $html_output .= ' ' . __('Because of its length,
this column might not be editable'); + $html_output .= "\n"; + $html_output .= '' . __('Because of its length,
this column might not be editable'); } } elseif ($column['pma_type'] == 'enum') { - $html_output .= PMA_getPmaTypeEnum($paramsArrayForColumns, $column,$extracted_columnspec); + $html_output .= PMA_getPmaTypeEnum( + $paramsArrayForColumns, $column,$extracted_columnspec + ); } elseif ($column['pma_type'] == 'set') { - $html_output .= PMA_getPmaTypeSet($column,$extracted_columnspec, $backup_field, - $column_name_appendix, $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex); + $html_output .= PMA_getPmaTypeSet( + $column,$extracted_columnspec, $backup_field, + $column_name_appendix, $unnullify_trigger, $tabindex, + $tabindex_for_value, $idindex + ); } elseif ($column['is_binary'] || $column['is_blob']) { - $html_output .= PMA_getBinaryAndBlobColumn($column, $data, $special_chars,$biggest_max_file_size, - $backup_field,$column_name_appendix, $unnullify_trigger, $tabindex, $tabindex_for_value, - $idindex, $text_dir, $special_chars_encoded, $vkey, $is_upload); + $html_output .= PMA_getBinaryAndBlobColumn( + $column, $data, $special_chars,$biggest_max_file_size, + $backup_field,$column_name_appendix, $unnullify_trigger, $tabindex, + $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded, + $vkey, $is_upload + ); } elseif (! in_array($column['pma_type'], $no_support_types)) { - $html_output .= PMA_getNoSupportTypes($column, $default_char_editing,$backup_field, + $html_output .= PMA_getNoSupportTypes( + $column, $default_char_editing,$backup_field, $column_name_appendix, $unnullify_trigger,$tabindex,$special_chars, - $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded, $data, $extracted_columnspec); + $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded, + $data, $extracted_columnspec + ); } if (in_array($column['pma_type'], $gis_data_types)) { @@ -620,18 +676,19 @@ function PMA_getValueColumn($column, $backup_field, $column_name_appendix, /** * Get HTML for foreign link in insert form * - * @param array $column description of column in given table - * @param string $backup_field hidden input field - * @param string $column_name_appendix the name atttibute - * @param string $unnullify_trigger validation string + * @param array $column description of column in given table + * @param string $backup_field hidden input field + * @param string $column_name_appendix the name atttibute + * @param string $unnullify_trigger validation string * @param integer $tabindex tab index * @param integer $tabindex_for_value offset for the values tabindex * @param integer $idindex id index - * @param array $data - * @param array $paramTableDbArray array containing $db and $table - * @param array $rownumber_param &rownumber=row_id - * @param array $titles An HTML IMG tag for a particular icon from a theme, - * which may be an actual file or an icon from a sprite + * @param array $data + * @param array $paramTableDbArray array containing $db and $table + * @param array $rownumber_param &rownumber=row_id + * @param array $titles An HTML IMG tag for a particular icon from + * a theme, which may be an actual file or + * an icon from a sprite * * @return string an html snippet */ @@ -659,19 +716,20 @@ function PMA_getForeignLink($column, $backup_field, $column_name_appendix, /** * Get HTML to display foreign data * - * @param string $backup_field hidden input field - * @param string $column_name_appendix the name atttibute - * @param string $unnullify_trigger validation string + * @param string $backup_field hidden input field + * @param string $column_name_appendix the name atttibute + * @param string $unnullify_trigger validation string * @param integer $tabindex tab index * @param integer $tabindex_for_value offset for the values tabindex * @param integer $idindex id index - * @param array $data - * @param array $foreignData data about the foreign keys + * @param array $data + * @param array $foreignData data about the foreign keys * * @return string an html snippet */ function PMA_dispRowForeignData($backup_field, $column_name_appendix, - $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $data, $foreignData + $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $data, + $foreignData ) { $html_output = ''; $html_output .= $backup_field . "\n"; @@ -690,19 +748,20 @@ function PMA_dispRowForeignData($backup_field, $column_name_appendix, /** * Get HTML textarea for insert form * - * @param string $backup_field hidden input field - * @param string $column_name_appendix the name atttibute - * @param string $unnullify_trigger validation string - * @param integer $tabindex tab index - * @param integer $tabindex_for_value offset for the values tabindex - * @param integer $idindex id index - * @param array $text_dir - * @param array $special_chars_encoded replaced char if the string starts - * with a \r\n pair (0x0d0a) add an extra \n + * @param string $backup_field hidden input field + * @param string $column_name_appendix the name atttibute + * @param string $unnullify_trigger validation string + * @param integer $tabindex tab index + * @param integer $tabindex_for_value offset for the values tabindex + * @param integer $idindex id index + * @param array $text_dir + * @param array $special_chars_encoded replaced char if the string starts + * with a \r\n pair (0x0d0a) add an extra \n * * @return string an html snippet */ -function PMA_getTextarea($column, $backup_field, $column_name_appendix, $unnullify_trigger, +function PMA_getTextarea($column, $backup_field, $column_name_appendix, + $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded ) { $the_class = ''; @@ -735,44 +794,47 @@ function PMA_getTextarea($column, $backup_field, $column_name_appendix, $unnulli /** * Get HTML for enum type * - * @param array $column description of column in given table - * @param string $backup_field hidden input field - * @param string $column_name_appendix the name atttibute - * @param array $extracted_columnspec associative array containing type, spec_in_brackets - * and possibly enum_set_values (another array) + * @param array $column description of column in given table + * @param string $backup_field hidden input field + * @param string $column_name_appendix the name atttibute + * @param array $extracted_columnspec associative array containing type, + * spec_in_brackets and possibly + * enum_set_values (another array) * - * @return string an html snippet + * @return string an html snippet */ -function PMA_getPmaTypeEnum($column, $backup_field, $column_name_appendix, $extracted_columnspec) -{ +function PMA_getPmaTypeEnum( + $column, $backup_field, $column_name_appendix, $extracted_columnspec +) { $html_output = ''; if (! isset($column['values'])) { $column['values'] = PMA_getColumnEnumValues($column, $extracted_columnspec); - } - $column_enum_values = $column['values']; - $html_output .= ''; - $html_output .= ''; - $html_output .= "\n" . ' ' . $backup_field . "\n"; - if (strlen($column['Type']) > 20) { - $html_output .= PMA_getDropDownDependingOnLength($column, $column_name_appendix, $unnullify_trigger, + } + $column_enum_values = $column['values']; + $html_output .= ''; + $html_output .= ''; + $html_output .= "\n" . ' ' . $backup_field . "\n"; + if (strlen($column['Type']) > 20) { + $html_output .= PMA_getDropDownDependingOnLength($column, $column_name_appendix, $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $data, $column_enum_values - ); - } else { - $html_output .= PMA_getRadioButtonDependingOnLength($column_name_appendix, $unnullify_trigger, + ); + } else { + $html_output .= PMA_getRadioButtonDependingOnLength($column_name_appendix, $unnullify_trigger, $tabindex, $column, $tabindex_for_value, $idindex, $data, $column_enum_values - ); - } - return $html_output; + ); + } + return $html_output; } /** * Get column values * - * @param array $column description of column in given table - * @param array $extracted_columnspec associative array containing type, spec_in_brackets - * and possibly enum_set_values (another array) + * @param array $column description of column in given table + * @param array $extracted_columnspec associative array containing type, + * spec_in_brackets and possibly enum_set_values + * (another array) * - * @return array column values as an associative array + * @return array column values as an associative array */ function PMA_getColumnEnumValues($column, $extracted_columnspec) { @@ -791,18 +853,19 @@ function PMA_getColumnEnumValues($column, $extracted_columnspec) /** * Get HTML drop down for more than 20 string length * - * @param array $column description of column in given table - * @param string $column_name_appendix the name atttibute - * @param string $unnullify_trigger validation string + * @param array $column description of column in given table + * @param string $column_name_appendix the name atttibute + * @param string $unnullify_trigger validation string * @param integer $tabindex tab index * @param integer $tabindex_for_value offset for the values tabindex * @param integer $idindex id index - * @param array $data - * @param array $column_enum_values $column['values'] + * @param array $data + * @param array $column_enum_values $column['values'] * * @return string an html snippet */ -function PMA_getDropDownDependingOnLength($column, $column_name_appendix, $unnullify_trigger, +function PMA_getDropDownDependingOnLength( + $column, $column_name_appendix, $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $data, $column_enum_values ) { $html_output = '' . ''; } elseif ($column['is_blob']) { - $html_output .= "\n" - . PMA_getTextarea($column,$backup_field, $column_name_appendix, $unnullify_trigger, - $tabindex, $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded); + $html_output .= "\n" . PMA_getTextarea( + $column, $backup_field, $column_name_appendix, $unnullify_trigger, + $tabindex, $tabindex_for_value, $idindex, $text_dir, + $special_chars_encoded + ); } else { // field size should be at least 4 and max $GLOBALS['cfg']['LimitChars'] $fieldsize = min(max($column['len'], 4), $GLOBALS['cfg']['LimitChars']); - $html_output .= "\n" - . $backup_field . "\n" - . PMA_getHTMLinput($column, $column_name_appendix, $special_chars, $fieldsize, - $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex); + $html_output .= "\n" . $backup_field . "\n" . PMA_getHTMLinput( + $column, $column_name_appendix, $special_chars, $fieldsize, + $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex + ); } if ($is_upload && $column['is_blob']) { $html_output .= '
' . ' '; - list($html_out, $biggest_max_file_size) = PMA_getMaxUploadSize($column,$biggest_max_file_size); + list($html_out, $biggest_max_file_size) = PMA_getMaxUploadSize( + $column, $biggest_max_file_size + ); $html_output .= $html_out; } @@ -1005,11 +1080,11 @@ function PMA_getBinaryAndBlobColumn($column, $data, $special_chars,$biggest_max_ /** * Get HTML input type * - * @param array $column description of column in given table - * @param string $column_name_appendix the name atttibute - * @param array $special_chars special characters + * @param array $column description of column in given table + * @param string $column_name_appendix the name atttibute + * @param array $special_chars special characters * @param integer $fieldsize html field size - * @param string $unnullify_trigger validation string + * @param string $unnullify_trigger validation string * @param integer $tabindex tab index * @param integer $tabindex_for_value offset for the values tabindex * @param integer $idindex id index @@ -1037,8 +1112,8 @@ function PMA_getHTMLinput($column, $column_name_appendix, $special_chars, /** * Get HTML select option for upload * - * @param string $vkey [multi_edit]['row_id'] - * @param array $column description of column in given table + * @param string $vkey [multi_edit]['row_id'] + * @param array $column description of column in given table * * @return string an html snippet */ @@ -1064,7 +1139,7 @@ function PMA_getSelectOptionForUpload($vkey, $column) * @param array $column description of column in given table * @param integer $biggest_max_file_size biggest max file size for uploading * - * @return array an html snippet and $biggest_max_file_size + * @return array an html snippet and $biggest_max_file_size */ function PMA_getMaxUploadSize($column, $biggest_max_file_size) { @@ -1096,25 +1171,26 @@ function PMA_getMaxUploadSize($column, $biggest_max_file_size) /** * Get HTML for pma no support types * - * @param array $column description of column in given table - * @param string $default_char_editing default char editing mode which is stroe - * in the config.inc.php script - * @param string $backup_field hidden input field - * @param string $column_name_appendix the name atttibute - * @param string $unnullify_trigger validation string - * @param integer $tabindex tab index - * @param array $special_chars apecial characters - * @param integer $tabindex_for_value offset for the values tabindex - * @param integer $idindex id index - * @param string $text_dir - * @param array $special_chars_encoded replaced char if the string starts - * with a \r\n pair (0x0d0a) add an extra \n + * @param array $column description of column in given table + * @param string $default_char_editing default char editing mode which is stroe + * in the config.inc.php script + * @param string $backup_field hidden input field + * @param string $column_name_appendix the name atttibute + * @param string $unnullify_trigger validation string + * @param integer $tabindex tab index + * @param array $special_chars apecial characters + * @param integer $tabindex_for_value offset for the values tabindex + * @param integer $idindex id index + * @param string $text_dir + * @param array $special_chars_encoded replaced char if the string starts + * with a \r\n pair (0x0d0a) add an extra \n * - * @return string an html snippet + * @return string an html snippet */ -function PMA_getNoSupportTypes($column, $default_char_editing,$backup_field, - $column_name_appendix, $unnullify_trigger,$tabindex,$special_chars, - $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded,$data, $extracted_columnspec +function PMA_getNoSupportTypes($column, $default_char_editing, $backup_field, + $column_name_appendix, $unnullify_trigger, $tabindex, $special_chars, + $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded, $data, + $extracted_columnspec ) { $fieldsize = PMA_getColumnSize($column, $extracted_columnspec); $html_output = $backup_field . "\n"; @@ -1124,11 +1200,15 @@ function PMA_getNoSupportTypes($column, $default_char_editing,$backup_field, ) { $html_output .= "\n"; $GLOBALS['cfg']['CharEditing'] = $default_char_editing; - $html_output .= PMA_getTextarea($column, $backup_field, $column_name_appendix, $unnullify_trigger, - $tabindex, $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded); + $html_output .= PMA_getTextarea( + $column, $backup_field, $column_name_appendix, $unnullify_trigger, + $tabindex, $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded + ); } else { - $html_output .= PMA_getHTMLinput($column, $column_name_appendix, $special_chars, - $fieldsize, $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex); + $html_output .= PMA_getHTMLinput( + $column, $column_name_appendix, $special_chars, + $fieldsize, $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex + ); if ($column['Extra'] == 'auto_increment') { $html_output .= ''; @@ -1214,10 +1294,10 @@ function PMA_getHTMLforGisDataTypes($current_row, $column) /** * get html for continue insertion form * - * @param string $table name of the table - * @param string $db name of the database - * @param array $where_clause_array array of where clauses - * @param string $err_url error url + * @param string $table name of the table + * @param string $db name of the database + * @param array $where_clause_array array of where clauses + * @param string $err_url error url * * @return string an html snippet */ @@ -1255,11 +1335,11 @@ function PMA_getContinueInsertionForm($table, $db, $where_clause_array, $err_url /** * Get action panel * - * @param integer $tabindex tab index - * @param integer $tabindex_for_value offset for the values tabindex - * @param boolean $found_unique_key boolean variable for unique key + * @param integer $tabindex tab index + * @param integer $tabindex_for_value offset for the values tabindex + * @param boolean $found_unique_key boolean variable for unique key * - * @return string an html snippet + * @return string an html snippet */ function PMA_getActionsPanel($where_clause, $after_insert, $tabindex, $tabindex_for_value, $found_unique_key @@ -1290,9 +1370,9 @@ function PMA_getActionsPanel($where_clause, $after_insert, $tabindex, /** * Get a HTML drop down for submit types * - * @param array $where_clause where clause - * @param integer $tabindex tab index - * @param integer $tabindex_for_value offset for the values tabindex + * @param array $where_clause where clause + * @param integer $tabindex tab index + * @param integer $tabindex_for_value offset for the values tabindex * * @return string an html snippet */ @@ -1312,9 +1392,9 @@ function PMA_getSubmitTypeDropDown($where_clause, $tabindex, $tabindex_for_value /** * Get HTML drop down for after insert * - * @param array $where_clause where clause - * @param string $after_insert insert mode, e.g. new_insert, same_insert - * @param string $after_insert a request parameter it can be 'edit_text', 'back' + * @param array $where_clause where clause + * @param string $after_insert insert mode, e.g. new_insert, same_insert + * @param string $after_insert a request parameter it can be 'edit_text', 'back' * @param boolean $found_unique_key boolean variable for unique key * * @return string an html snippet @@ -1412,17 +1492,17 @@ function PMA_getHeadAndFootOfInsertRowTable($url_params) /** * Prepares the field value and retrieve special chars, backup field and data array * - * @param array $current_row a row of the table - * @param array $column description of column in given table - * @param array $extracted_columnspec associative array containing type, spec_in_brackets + * @param array $current_row a row of the table + * @param array $column description of column in given table + * @param array $extracted_columnspec associative array containing type, spec_in_brackets * and possibly enum_set_values (another array) * @param boolean $real_null_value whether column value null or not null * - * @return array $real_null_value, $data, $special_chars, $backup_field, $special_chars_encoded + * @return array $real_null_value, $data, $special_chars, $backup_field, $special_chars_encoded */ function PMA_getSpecialCharsAndBackupFieldForExistingRow($current_row, $column, $extracted_columnspec, - $real_null_value, $gis_data_types, $column_name_appendix) -{ + $real_null_value, $gis_data_types, $column_name_appendix +) { $special_chars_encoded = ''; // (we are editing) if (is_null($current_row[$column['Field']])) { @@ -1477,10 +1557,10 @@ function PMA_getSpecialCharsAndBackupFieldForExistingRow($current_row, $column, /** * display default values * - * @param type $column description of column in given table - * @param boolean $real_null_value whether column value null or not null + * @param type $column description of column in given table + * @param boolean $real_null_value whether column value null or not null * - * @return array $real_null_value, $data, $special_chars, $backup_field, $special_chars_encoded + * @return array $real_null_value, $data, $special_chars, $backup_field, $special_chars_encoded */ function PMA_getSpecialCharsAndBackupFieldForInsertingMode($column, $real_null_value) { @@ -1562,7 +1642,7 @@ function PMA_isInsertRow() /** * set $_SESSION for edit_next * - * @param string $one_where_clause one where clause from where clauses array + * @param string $one_where_clause one where clause from where clauses array * * @return void */ @@ -1589,13 +1669,14 @@ function PMA_setSessionForEditNext($one_where_clause) * if $GLOBALS['goto'] empty, if $goto_include previously not defined * and new_insert, same_insert, same_insert * - * @param string $goto_include store some script for include, otherwise it is boolean false + * @param string $goto_include store some script for include, otherwise it is boolean false + * * @return string $goto_include */ function PMA_getGotoInclude($goto_include) { if (isset($_REQUEST['after_insert']) - && in_array($_REQUEST['after_insert'], array('new_insert', 'same_insert', 'same_insert')) + && in_array($_REQUEST['after_insert'], array('new_insert', 'same_insert', 'same_insert')) ) { $goto_include = 'tbl_change.php'; } elseif (! empty($GLOBALS['goto'])) { @@ -1624,6 +1705,7 @@ function PMA_getGotoInclude($goto_include) * Defines the url to return in case of failure of the query * * @param array $url_params url parameters + * * @return string error url for query failure */ function PMA_getErrorUrl($url_params) @@ -1639,8 +1721,9 @@ function PMA_getErrorUrl($url_params) * Builds the sql query * * @param boolean $is_insertignore $_REQUEST['submit_type'] == 'insertignore' - * @param array $query_fields column names array - * @param array $value_sets array of query values + * @param array $query_fields column names array + * @param array $value_sets array of query values + * * @return string a query */ function PMA_buildSqlQuery($is_insertignore, $query_fields, $value_sets) @@ -1659,10 +1742,11 @@ function PMA_buildSqlQuery($is_insertignore, $query_fields, $value_sets) /** * Executes the sql query and get the result, then move back to the calling page * - * @param array $url_params url paramters array - * @param string $query built query from PMA_buildSqlQuery() - * @return array $url_params, $total_affected_rows, $last_messages - * $warning_messages, $error_messages, $return_to_sql_query + * @param array $url_params url paramters array + * @param string $query built query from PMA_buildSqlQuery() + * + * @return array $url_params, $total_affected_rows, $last_messages + * $warning_messages, $error_messages, $return_to_sql_query */ function PMA_executeSqlQuery($url_params, $query) { @@ -1715,8 +1799,15 @@ function PMA_executeSqlQuery($url_params, $query) } $warning_messages = PMA_getWarningMessages(); } - unset($result, $single_query, $last_message, $query); - return array($url_params, $total_affected_rows, $last_messages, $warning_messages, $error_messages, $return_to_sql_query); + + return array( + $url_params, + $total_affected_rows, + $last_messages, + $warning_messages, + $error_messages, + $return_to_sql_query + ); } /** @@ -1728,10 +1819,9 @@ function PMA_getWarningMessages() { $warning_essages = array(); foreach (PMA_DBI_get_warnings() as $warning) { - $warning_essages[] - = PMA_Message::sanitize( - $warning['Level'] . ': #' . $warning['Code'] . ' ' . $warning['Message'] - ); + $warning_essages[] = PMA_Message::sanitize( + $warning['Level'] . ': #' . $warning['Code'] . ' ' . $warning['Message'] + ); } return $warning_essages; } diff --git a/libraries/transformations/text_plain__append.inc.php b/libraries/transformations/text_plain__append.inc.php index 22eb3534cf..9afbec16fd 100644 --- a/libraries/transformations/text_plain__append.inc.php +++ b/libraries/transformations/text_plain__append.inc.php @@ -2,6 +2,7 @@ /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * @package PhpMyAdmin-Transformation + * * Has one option: the text to be appended (default '') */ if (! defined('PHPMYADMIN')) { diff --git a/po/cs.po b/po/cs.po index 575b9cc69b..c25893ce80 100644 --- a/po/cs.po +++ b/po/cs.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-06-18 10:54+0200\n" -"PO-Revision-Date: 2012-06-04 15:36+0200\n" +"PO-Revision-Date: 2012-06-19 10:44+0200\n" "Last-Translator: Michal Čihař \n" "Language-Team: czech \n" "Language: cs\n" @@ -3416,7 +3416,7 @@ msgstr "Při použití funkce Blowfish z knihovny mcrypt došlo k chybě!" #: libraries/auth/cookie.auth.lib.php:139 msgid "Your session has expired. Please login again." -msgstr "" +msgstr "Vaše sezení vypršelo, prosím přihlaste se znovu." #: libraries/auth/cookie.auth.lib.php:227 msgid "Log in" diff --git a/po/hy.po b/po/hy.po index bdf49549c9..b731e5912d 100644 --- a/po/hy.po +++ b/po/hy.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-06-18 10:54+0200\n" -"PO-Revision-Date: 2012-06-15 12:12+0200\n" +"PO-Revision-Date: 2012-06-18 16:41+0200\n" "Last-Translator: Hamlet Muradyan \n" "Language-Team: none\n" "Language: hy\n" @@ -263,11 +263,11 @@ msgstr "%1$s տվյալների բազան վերանված է %2$s-ի" #: db_operations.php:318 #, php-format msgid "Database %1$s has been copied to %2$s" -msgstr "" +msgstr "%1$s տվյալների բազան պատճենված է %2$s-ում" #: db_operations.php:449 msgid "Rename database to" -msgstr "" +msgstr "Վերնվանել տվյալների բազան" #: db_operations.php:476 msgid "Remove database" @@ -284,7 +284,7 @@ msgstr "Հեռացնել տվյալների բազան (DROP)" #: db_operations.php:522 msgid "Copy database to" -msgstr "" +msgstr "Պատճենել տվյալների բազան" #: db_operations.php:529 tbl_operations.php:567 tbl_tracking.php:482 msgid "Structure only" diff --git a/po/sl.po b/po/sl.po index 6753905437..649792a9a9 100644 --- a/po/sl.po +++ b/po/sl.po @@ -4,15 +4,15 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-06-18 10:54+0200\n" -"PO-Revision-Date: 2012-06-05 16:15+0200\n" +"PO-Revision-Date: 2012-06-18 22:38+0200\n" "Last-Translator: Domen \n" "Language-Team: slovenian \n" "Language: sl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" -"%100==4 ? 2 : 3);\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || " +"n%100==4 ? 2 : 3);\n" "X-Generator: Weblate 1.0\n" #: browse_foreigners.php:36 browse_foreigners.php:60 js/messages.php:354 @@ -3442,7 +3442,7 @@ msgstr "Uporaba Blowfish iz mcrypt je spodletela!" #: libraries/auth/cookie.auth.lib.php:139 msgid "Your session has expired. Please login again." -msgstr "" +msgstr "Vaša seja je potekla. Prosimo, prijavite se znova." #: libraries/auth/cookie.auth.lib.php:227 msgid "Log in" diff --git a/po/tr.po b/po/tr.po index ecdff31840..bacd6967ae 100644 --- a/po/tr.po +++ b/po/tr.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-06-18 10:54+0200\n" -"PO-Revision-Date: 2012-06-01 19:33+0200\n" +"PO-Revision-Date: 2012-06-18 13:24+0200\n" "Last-Translator: Burak Yavuz \n" "Language-Team: turkish \n" "Language: tr\n" @@ -1891,11 +1891,10 @@ msgid "To zoom in, select a section of the plot with the mouse." msgstr "Yakınlaştırmak için fare ile çizimin bir bölümünü seçin." #: js/messages.php:306 -#, fuzzy #| msgid "Click reset zoom link to come back to original state." msgid "Click reset zoom button to come back to original state." msgstr "" -"Orijinal durumuna geri gelmesi için yakınlaştırmayı sıfırla bağlantısına " +"Orijinal durumuna geri gelmesi için yakınlaştırmayı sıfırla düğmesine " "tıklayın." #: js/messages.php:308 @@ -3435,7 +3434,7 @@ msgstr "mcrypt'tan Blowfish kullanmak başarısız!" #: libraries/auth/cookie.auth.lib.php:139 msgid "Your session has expired. Please login again." -msgstr "" +msgstr "Oturumunuzun süresi doldu. Lütfen tekrar oturum açın." #: libraries/auth/cookie.auth.lib.php:227 msgid "Log in" diff --git a/test/classes/gis/PMA_GIS_Geometry_test.php b/test/classes/gis/PMA_GIS_Geometry_test.php index d27aa068ae..d4e5b91228 100644 --- a/test/classes/gis/PMA_GIS_Geometry_test.php +++ b/test/classes/gis/PMA_GIS_Geometry_test.php @@ -265,7 +265,8 @@ class PMA_GIS_GeometryTest extends PHPUnit_Framework_TestCase ); } - public function providerForTestGetBoundsForOl() { + public function providerForTestGetBoundsForOl() + { return array( array( @@ -278,7 +279,7 @@ class PMA_GIS_GeometryTest extends PHPUnit_Framework_TestCase ), 'bound = new OpenLayers.Bounds(); bound.extend(new OpenLayers.LonLat(0, 0).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())); bound.extend(new OpenLayers.LonLat(1, 1).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));' ) - + ); } @@ -300,16 +301,16 @@ class PMA_GIS_GeometryTest extends PHPUnit_Framework_TestCase $output ); } - + public function providerForTestGetPolygonArrayForOpenLayers(){ - + return array( - array( + array( array('Triangle'), 4326, 'new Array(new OpenLayers.Geometry.Polygon(new Array(new OpenLayers.Geometry.LinearRing(new Array((new OpenLayers.Geometry.Point(,)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()))))))' ) - + ); } diff --git a/test/classes/gis/PMA_GIS_Geometrycollection_test.php b/test/classes/gis/PMA_GIS_Geometrycollection_test.php index 813b0be9f5..569d4845a9 100644 --- a/test/classes/gis/PMA_GIS_Geometrycollection_test.php +++ b/test/classes/gis/PMA_GIS_Geometrycollection_test.php @@ -13,8 +13,11 @@ require_once 'libraries/tcpdf/tcpdf.php'; /** * Tests for PMA_GIS_Geometrycollection class + * + * @package PhpMyAdmin-test */ -class PMA_GIS_Geometrycollection_test extends PHPUnit_Framework_TestCase { +class PMA_GIS_Geometrycollection_test extends PHPUnit_Framework_TestCase +{ /** * @access protected @@ -28,7 +31,8 @@ class PMA_GIS_Geometrycollection_test extends PHPUnit_Framework_TestCase { * @access protected * @return void */ - protected function setUp() { + protected function setUp() + { $this->object = PMA_GIS_Geometrycollection::singleton(); } @@ -39,22 +43,25 @@ class PMA_GIS_Geometrycollection_test extends PHPUnit_Framework_TestCase { * @access protected * @return void */ - protected function tearDown() { + protected function tearDown() + { unset($this->object); } /** * - * @param type $spatial - * + * @param type $spatial + * * @dataProvider providerForScaleRow */ - public function testScaleRow($spatial, $output) { + public function testScaleRow($spatial, $output) + { $this->assertEquals($this->object->scaleRow($spatial), $output); } - public function providerForScaleRow() { + public function providerForScaleRow() + { return array( array( @@ -74,16 +81,18 @@ class PMA_GIS_Geometrycollection_test extends PHPUnit_Framework_TestCase { * @param type $gis_data * @param type $index * @param string $empty - * @param type $output - * + * @param type $output + * * @dataProvider providerForGenerateWkt */ - public function testGenerateWkt($gis_data, $index, $empty, $output) { + public function testGenerateWkt($gis_data, $index, $empty, $output) + { $this->assertEquals($this->object->generateWkt($gis_data, $index, $empty = ''), $output); } - public function providerForGenerateWkt() { + public function providerForGenerateWkt() + { $temp1 = array( 0 => array( @@ -112,12 +121,14 @@ class PMA_GIS_Geometrycollection_test extends PHPUnit_Framework_TestCase { * * @dataProvider providerForGenerateParams */ - public function testGenerateParams($value, $output) { + public function testGenerateParams($value, $output) + { $this->assertEquals($this->object->generateParams($value), $output); } - public function providerForGenerateParams() { + public function providerForGenerateParams() + { return array( array( @@ -153,17 +164,19 @@ class PMA_GIS_Geometrycollection_test extends PHPUnit_Framework_TestCase { * @param type $line_color * @param type $scale_data * @param type $image - * @param type $output - * + * @param type $output + * * @dataProvider providerForPrepareRowAsPng */ - public function testPrepareRowAsPng($spatial, $label, $line_color, $scale_data, $image, $output) { + public function testPrepareRowAsPng($spatial, $label, $line_color, $scale_data, $image, $output) + { $return = $this->object->prepareRowAsPng($spatial, $label, $line_color, $scale_data, $image); $this->assertTrue(true); } - public function providerForPrepareRowAsPng() { + public function providerForPrepareRowAsPng() + { return array( array( @@ -189,16 +202,18 @@ class PMA_GIS_Geometrycollection_test extends PHPUnit_Framework_TestCase { * @param type $line_color * @param type $scale_data * @param type $pdf - * + * * @dataProvider providerForPrepareRowAsPdf */ - public function testPrepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf) { + public function testPrepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf) + { $return = $this->object->prepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf); $this->assertTrue($return instanceof TCPDF); } - public function providerForPrepareRowAsPdf() { + public function providerForPrepareRowAsPdf() + { return array( array( @@ -222,18 +237,20 @@ class PMA_GIS_Geometrycollection_test extends PHPUnit_Framework_TestCase { * @param type $label * @param type $line_color * @param type $scale_data - * @param type $output - * - * @dataProvider providerForPrepareRowAsSvg + * @param type $output + * + * @dataProvider providerForPrepareRowAsSvg */ - public function testPrepareRowAsSvg($spatial, $label, $line_color, $scale_data, $output) { + public function testPrepareRowAsSvg($spatial, $label, $line_color, $scale_data, $output) + { $string = $this->object->prepareRowAsSvg($spatial, $label, $line_color, $scale_data); $this->assertEquals(1, preg_match($output, $string)); // $this->assertEquals($this->object->prepareRowAsSvg($spatial, $label, $line_color, $scale_data) , $output); } - public function providerForPrepareRowAsSvg() { + public function providerForPrepareRowAsSvg() + { return array( array( @@ -258,16 +275,18 @@ class PMA_GIS_Geometrycollection_test extends PHPUnit_Framework_TestCase { * @param type $label * @param type $line_color * @param type $scale_data - * @param type $output - * + * @param type $output + * * @dataProvider providerForPrepareRowAsOl */ - public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output) { + public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output) + { $this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data), $output); } - public function providerForPrepareRowAsOl() { + public function providerForPrepareRowAsOl() + { return array( array( diff --git a/test/classes/gis/PMA_GIS_Linestring_test.php b/test/classes/gis/PMA_GIS_Linestring_test.php index 82041d9b70..cbd00e5229 100644 --- a/test/classes/gis/PMA_GIS_Linestring_test.php +++ b/test/classes/gis/PMA_GIS_Linestring_test.php @@ -162,7 +162,7 @@ class PMA_GIS_LinestringTest extends PMA_GIS_GeomTest ) ); } - + /** * * @param type $spatial @@ -170,18 +170,19 @@ class PMA_GIS_LinestringTest extends PMA_GIS_GeomTest * @param type $line_color * @param type $scale_data * @param type $image - * @param type $output - * + * @param type $output + * *@dataProvider providerForPrepareRowAsPng */ - public function testPrepareRowAsPng($spatial, $label, $line_color, $scale_data, $image, $output) { - + public function testPrepareRowAsPng($spatial, $label, $line_color, $scale_data, $image, $output) + { + $return = $this->object->prepareRowAsPng($spatial, $label, $line_color, $scale_data, $image); $this->assertTrue(true); } - + public function providerForPrepareRowAsPng(){ - + return array( array( 'LINESTRING(12 35,48 75,69 23,25 45,14 53,35 78)', @@ -196,7 +197,7 @@ class PMA_GIS_LinestringTest extends PMA_GIS_GeomTest imagecreatetruecolor('120','150'), '' ) - + ); } @@ -207,17 +208,18 @@ class PMA_GIS_LinestringTest extends PMA_GIS_GeomTest * @param type $line_color * @param type $scale_data * @param type $pdf - * + * *@dataProvider providerForPrepareRowAsPdf */ - public function testPrepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf) { - + public function testPrepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf) + { + $return = $this->object->prepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf); $this->assertTrue($return instanceof TCPDF); } - + public function providerForPrepareRowAsPdf(){ - + return array( array( 'LINESTRING(12 35,48 75,69 23,25 45,14 53,35 78)', @@ -230,29 +232,30 @@ class PMA_GIS_LinestringTest extends PMA_GIS_GeomTest 'height' => 150 ), new TCPDF(), - ) + ) ); } - + /** * * @param type $spatial * @param type $label * @param type $line_color * @param type $scale_data - * @param type $output - * - *@dataProvider providerForPrepareRowAsSvg + * @param type $output + * + *@dataProvider providerForPrepareRowAsSvg */ - public function testPrepareRowAsSvg($spatial, $label, $line_color, $scale_data, $output) { - + public function testPrepareRowAsSvg($spatial, $label, $line_color, $scale_data, $output) + { + $string = $this->object->prepareRowAsSvg($spatial, $label, $line_color, $scale_data); $this->assertEquals(1, preg_match($output, $string)); //$this->assertEquals($this->object->prepareRowAsSvg($spatial, $label, $line_color, $scale_data) , $output); } - + public function providerForPrepareRowAsSvg(){ - + return array( array( 'LINESTRING(12 35,48 75,69 23,25 45,14 53,35 78)', @@ -265,7 +268,7 @@ class PMA_GIS_LinestringTest extends PMA_GIS_GeomTest 'height' => 150 ), '/^()$/' - ) + ) ); } @@ -276,17 +279,18 @@ class PMA_GIS_LinestringTest extends PMA_GIS_GeomTest * @param type $label * @param type $line_color * @param type $scale_data - * @param type $output - * + * @param type $output + * *@dataProvider providerForPrepareRowAsOl */ - public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output) { - + public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output) + { + $this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data) , $output); } - + public function providerForPrepareRowAsOl(){ - + return array( array( 'LINESTRING(12 35,48 75,69 23,25 45,14 53,35 78)', @@ -300,7 +304,7 @@ class PMA_GIS_LinestringTest extends PMA_GIS_GeomTest 'maxY' => '1', ), 'bound = new OpenLayers.Bounds(); bound.extend(new OpenLayers.LonLat(0, 0).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())); bound.extend(new OpenLayers.LonLat(1, 1).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));vectorLayer.addFeatures(new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(new Array((new OpenLayers.Geometry.Point(12,35)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(48,75)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(69,23)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(25,45)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(14,53)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(35,78)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()))), null, {"strokeColor":"#B02EE0","strokeWidth":2,"label":"Ol","fontSize":10}));' - ) + ) ); } } diff --git a/test/classes/gis/PMA_GIS_Multilinestring_test.php b/test/classes/gis/PMA_GIS_Multilinestring_test.php index bf927ea93c..e3d7435c88 100644 --- a/test/classes/gis/PMA_GIS_Multilinestring_test.php +++ b/test/classes/gis/PMA_GIS_Multilinestring_test.php @@ -222,8 +222,8 @@ class PMA_GIS_MultilinestringTest extends PMA_GIS_GeomTest ) ); } - - + + /** * * @param type $spatial @@ -231,18 +231,19 @@ class PMA_GIS_MultilinestringTest extends PMA_GIS_GeomTest * @param type $line_color * @param type $scale_data * @param type $image - * @param type $output - * + * @param type $output + * *@dataProvider providerForPrepareRowAsPng */ - public function testPrepareRowAsPng($spatial, $label, $line_color, $scale_data, $image, $output) { - + public function testPrepareRowAsPng($spatial, $label, $line_color, $scale_data, $image, $output) + { + $return = $this->object->prepareRowAsPng($spatial, $label, $line_color, $scale_data, $image); $this->assertTrue(true); } - + public function providerForPrepareRowAsPng(){ - + return array( array( 'MULTILINESTRING((36 14,47 23,62 75),(36 10,17 23,178 53))', @@ -257,7 +258,7 @@ class PMA_GIS_MultilinestringTest extends PMA_GIS_GeomTest imagecreatetruecolor('120','150'), '' ) - + ); } @@ -268,17 +269,18 @@ class PMA_GIS_MultilinestringTest extends PMA_GIS_GeomTest * @param type $line_color * @param type $scale_data * @param type $pdf - * + * *@dataProvider providerForPrepareRowAsPdf */ - public function testPrepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf) { - + public function testPrepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf) + { + $return = $this->object->prepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf); $this->assertTrue($return instanceof TCPDF); } - + public function providerForPrepareRowAsPdf(){ - + return array( array( 'MULTILINESTRING((36 14,47 23,62 75),(36 10,17 23,178 53))', @@ -291,29 +293,30 @@ class PMA_GIS_MultilinestringTest extends PMA_GIS_GeomTest 'height' => 150 ), new TCPDF(), - ) + ) ); } - + /** * * @param type $spatial * @param type $label * @param type $line_color * @param type $scale_data - * @param type $output - * - *@dataProvider providerForPrepareRowAsSvg + * @param type $output + * + *@dataProvider providerForPrepareRowAsSvg */ - public function testPrepareRowAsSvg($spatial, $label, $line_color, $scale_data, $output) { - + public function testPrepareRowAsSvg($spatial, $label, $line_color, $scale_data, $output) + { + $string = $this->object->prepareRowAsSvg($spatial, $label, $line_color, $scale_data); $this->assertEquals(1, preg_match($output, $string)); //$this->assertEquals($this->object->prepareRowAsSvg($spatial, $label, $line_color, $scale_data) , $output); } - + public function providerForPrepareRowAsSvg(){ - + return array( array( 'MULTILINESTRING((36 14,47 23,62 75),(36 10,17 23,178 53))', @@ -326,7 +329,7 @@ class PMA_GIS_MultilinestringTest extends PMA_GIS_GeomTest 'height' => 150 ), '/^()$/' - ) + ) ); } @@ -337,17 +340,18 @@ class PMA_GIS_MultilinestringTest extends PMA_GIS_GeomTest * @param type $label * @param type $line_color * @param type $scale_data - * @param type $output - * + * @param type $output + * *@dataProvider providerForPrepareRowAsOl */ - public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output) { - + public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output) + { + $this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data) , $output); } - + public function providerForPrepareRowAsOl(){ - + return array( array( 'MULTILINESTRING((36 14,47 23,62 75),(36 10,17 23,178 53))', @@ -361,7 +365,7 @@ class PMA_GIS_MultilinestringTest extends PMA_GIS_GeomTest 'maxY' => '1', ), 'bound = new OpenLayers.Bounds(); bound.extend(new OpenLayers.LonLat(0, 0).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())); bound.extend(new OpenLayers.LonLat(1, 1).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));vectorLayer.addFeatures(new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiLineString(new Array(new OpenLayers.Geometry.LineString(new Array((new OpenLayers.Geometry.Point(36,14)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(47,23)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(62,75)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()))), new OpenLayers.Geometry.LineString(new Array((new OpenLayers.Geometry.Point(36,10)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(17,23)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(178,53)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()))))), null, {"strokeColor":"#B02EE0","strokeWidth":2,"label":"Ol","fontSize":10}));' - ) + ) ); } } diff --git a/test/classes/gis/PMA_GIS_Multipoint_test.php b/test/classes/gis/PMA_GIS_Multipoint_test.php index 185379a11a..160bcd6f87 100644 --- a/test/classes/gis/PMA_GIS_Multipoint_test.php +++ b/test/classes/gis/PMA_GIS_Multipoint_test.php @@ -166,8 +166,8 @@ class PMA_GIS_MultipointTest extends PMA_GIS_GeomTest ) ); } - - + + /** * * @param type $spatial @@ -175,18 +175,19 @@ class PMA_GIS_MultipointTest extends PMA_GIS_GeomTest * @param type $line_color * @param type $scale_data * @param type $image - * @param type $output - * + * @param type $output + * *@dataProvider providerForPrepareRowAsPng */ - public function testPrepareRowAsPng($spatial, $label, $line_color, $scale_data, $image, $output) { - + public function testPrepareRowAsPng($spatial, $label, $line_color, $scale_data, $image, $output) + { + $return = $this->object->prepareRowAsPng($spatial, $label, $line_color, $scale_data, $image); $this->assertTrue(true); } - + public function providerForPrepareRowAsPng(){ - + return array( array( 'MULTIPOINT(12 35,48 75,69 23,25 45,14 53,35 78)', @@ -201,7 +202,7 @@ class PMA_GIS_MultipointTest extends PMA_GIS_GeomTest imagecreatetruecolor('120','150'), '' ) - + ); } @@ -212,17 +213,18 @@ class PMA_GIS_MultipointTest extends PMA_GIS_GeomTest * @param type $line_color * @param type $scale_data * @param type $pdf - * + * *@dataProvider providerForPrepareRowAsPdf */ - public function testPrepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf) { - + public function testPrepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf) + { + $return = $this->object->prepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf); $this->assertTrue($return instanceof TCPDF); } - + public function providerForPrepareRowAsPdf(){ - + return array( array( 'MULTIPOINT(12 35,48 75,69 23,25 45,14 53,35 78)', @@ -235,29 +237,30 @@ class PMA_GIS_MultipointTest extends PMA_GIS_GeomTest 'height' => 150 ), new TCPDF(), - ) + ) ); } - + /** * * @param type $spatial * @param type $label * @param type $line_color * @param type $scale_data - * @param type $output - * - *@dataProvider providerForPrepareRowAsSvg + * @param type $output + * + *@dataProvider providerForPrepareRowAsSvg */ - public function testPrepareRowAsSvg($spatial, $label, $line_color, $scale_data, $output) { - + public function testPrepareRowAsSvg($spatial, $label, $line_color, $scale_data, $output) + { + $string = $this->object->prepareRowAsSvg($spatial, $label, $line_color, $scale_data); $this->assertEquals(1, preg_match($output, $string)); // $this->assertEquals($this->object->prepareRowAsSvg($spatial, $label, $line_color, $scale_data) , $output); } - + public function providerForPrepareRowAsSvg(){ - + return array( array( 'MULTIPOINT(12 35,48 75,69 23,25 45,14 53,35 78)', @@ -270,7 +273,7 @@ class PMA_GIS_MultipointTest extends PMA_GIS_GeomTest 'height' => 150 ), '/^()$/' - ) + ) ); } @@ -281,17 +284,18 @@ class PMA_GIS_MultipointTest extends PMA_GIS_GeomTest * @param type $label * @param type $line_color * @param type $scale_data - * @param type $output - * + * @param type $output + * *@dataProvider providerForPrepareRowAsOl */ - public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output) { - + public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output) + { + $this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data) , $output); } - + public function providerForPrepareRowAsOl(){ - + return array( array( 'MULTIPOINT(12 35,48 75,69 23,25 45,14 53,35 78)', @@ -305,7 +309,7 @@ class PMA_GIS_MultipointTest extends PMA_GIS_GeomTest 'maxY' => '1', ), 'bound = new OpenLayers.Bounds(); bound.extend(new OpenLayers.LonLat(0, 0).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())); bound.extend(new OpenLayers.LonLat(1, 1).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));vectorLayer.addFeatures(new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPoint(new Array((new OpenLayers.Geometry.Point(12,35)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(48,75)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(69,23)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(25,45)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(14,53)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(35,78)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()))), null, {"pointRadius":3,"fillColor":"#ffffff","strokeColor":"#B02EE0","strokeWidth":2,"label":"Ol","labelYOffset":-8,"fontSize":10}));' - ) + ) ); } } diff --git a/test/classes/gis/PMA_GIS_Multipolygon_test.php b/test/classes/gis/PMA_GIS_Multipolygon_test.php index 609c19665d..f68b8438b4 100644 --- a/test/classes/gis/PMA_GIS_Multipolygon_test.php +++ b/test/classes/gis/PMA_GIS_Multipolygon_test.php @@ -260,8 +260,8 @@ class PMA_GIS_MultipolygonTest extends PMA_GIS_GeomTest ) ); } - - + + /** * * @param type $spatial @@ -269,18 +269,19 @@ class PMA_GIS_MultipolygonTest extends PMA_GIS_GeomTest * @param type $line_color * @param type $scale_data * @param type $image - * @param type $output - * + * @param type $output + * *@dataProvider providerForPrepareRowAsPng */ - public function testPrepareRowAsPng($spatial, $label, $line_color, $scale_data, $image, $output) { - + public function testPrepareRowAsPng($spatial, $label, $line_color, $scale_data, $image, $output) + { + $return = $this->object->prepareRowAsPng($spatial, $label, $line_color, $scale_data, $image); $this->assertTrue(true); } - + public function providerForPrepareRowAsPng(){ - + return array( array( 'MULTIPOLYGON(((136 40,147 83,16 75,136 40)),((105 0,56 20,78 73,105 0)))', @@ -295,7 +296,7 @@ class PMA_GIS_MultipolygonTest extends PMA_GIS_GeomTest imagecreatetruecolor('120','150'), '' ) - + ); } @@ -306,17 +307,18 @@ class PMA_GIS_MultipolygonTest extends PMA_GIS_GeomTest * @param type $line_color * @param type $scale_data * @param type $pdf - * + * *@dataProvider providerForPrepareRowAsPdf */ - public function testPrepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf) { - + public function testPrepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf) + { + $return = $this->object->prepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf); $this->assertTrue($return instanceof TCPDF); } - + public function providerForPrepareRowAsPdf(){ - + return array( array( 'MULTIPOLYGON(((136 40,147 83,16 75,136 40)),((105 0,56 20,78 73,105 0)))', @@ -329,29 +331,30 @@ class PMA_GIS_MultipolygonTest extends PMA_GIS_GeomTest 'height' => 150 ), new TCPDF(), - ) + ) ); } - + /** * * @param type $spatial * @param type $label * @param type $line_color * @param type $scale_data - * @param type $output - * - *@dataProvider providerForPrepareRowAsSvg + * @param type $output + * + *@dataProvider providerForPrepareRowAsSvg */ - public function testPrepareRowAsSvg($spatial, $label, $line_color, $scale_data, $output) { - + public function testPrepareRowAsSvg($spatial, $label, $line_color, $scale_data, $output) + { + $string = $this->object->prepareRowAsSvg($spatial, $label, $line_color, $scale_data); $this->assertEquals(1, preg_match($output, $string)); // $this->assertEquals($this->object->prepareRowAsSvg($spatial, $label, $line_color, $scale_data) , $output); } - + public function providerForPrepareRowAsSvg(){ - + return array( array( 'MULTIPOLYGON(((136 40,147 83,16 75,136 40)),((105 0,56 20,78 73,105 0)))', @@ -364,7 +367,7 @@ class PMA_GIS_MultipolygonTest extends PMA_GIS_GeomTest 'height' => 150 ), '/^()$/' - ) + ) ); } @@ -375,17 +378,18 @@ class PMA_GIS_MultipolygonTest extends PMA_GIS_GeomTest * @param type $label * @param type $line_color * @param type $scale_data - * @param type $output - * + * @param type $output + * *@dataProvider providerForPrepareRowAsOl */ - public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output) { - + public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output) + { + $this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data) , $output); } - + public function providerForPrepareRowAsOl(){ - + return array( array( 'MULTIPOLYGON(((136 40,147 83,16 75,136 40)),((105 0,56 20,78 73,105 0)))', @@ -399,7 +403,7 @@ class PMA_GIS_MultipolygonTest extends PMA_GIS_GeomTest 'maxY' => '1', ), 'bound = new OpenLayers.Bounds(); bound.extend(new OpenLayers.LonLat(0, 0).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())); bound.extend(new OpenLayers.LonLat(1, 1).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));vectorLayer.addFeatures(new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPolygon(new Array(new OpenLayers.Geometry.Polygon(new Array(new OpenLayers.Geometry.LinearRing(new Array((new OpenLayers.Geometry.Point(136,40)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(147,83)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(16,75)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(136,40)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()))))), new OpenLayers.Geometry.Polygon(new Array(new OpenLayers.Geometry.LinearRing(new Array((new OpenLayers.Geometry.Point(105,0)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(56,20)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(78,73)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(105,0)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()))))))), null, {"strokeColor":"#000000","strokeWidth":0.5,"fillColor":"#B02EE0","fillOpacity":0.8,"label":"Ol","fontSize":10}));' - ) + ) ); } } diff --git a/test/classes/gis/PMA_GIS_Point_test.php b/test/classes/gis/PMA_GIS_Point_test.php index e7f6a40148..fd17bde249 100644 --- a/test/classes/gis/PMA_GIS_Point_test.php +++ b/test/classes/gis/PMA_GIS_Point_test.php @@ -168,8 +168,8 @@ class PMA_GIS_PointTest extends PMA_GIS_GeomTest ) ); } - - + + /** * * @param type $spatial @@ -177,18 +177,19 @@ class PMA_GIS_PointTest extends PMA_GIS_GeomTest * @param type $line_color * @param type $scale_data * @param type $image - * @param type $output - * + * @param type $output + * *@dataProvider providerForPrepareRowAsPng */ - public function testPrepareRowAsPng($spatial, $label, $line_color, $scale_data, $image, $output) { - + public function testPrepareRowAsPng($spatial, $label, $line_color, $scale_data, $image, $output) + { + $return = $this->object->prepareRowAsPng($spatial, $label, $line_color, $scale_data, $image); $this->assertTrue(true); } - + public function providerForPrepareRowAsPng(){ - + return array( array( 'POINT(12 35)', @@ -203,7 +204,7 @@ class PMA_GIS_PointTest extends PMA_GIS_GeomTest imagecreatetruecolor('120','150'), '' ) - + ); } @@ -214,17 +215,18 @@ class PMA_GIS_PointTest extends PMA_GIS_GeomTest * @param type $line_color * @param type $scale_data * @param type $pdf - * + * *@dataProvider providerForPrepareRowAsPdf */ - public function testPrepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf) { - + public function testPrepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf) + { + $return = $this->object->prepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf); $this->assertTrue($return instanceof TCPDF); } - + public function providerForPrepareRowAsPdf(){ - + return array( array( 'POINT(12 35)', @@ -237,28 +239,29 @@ class PMA_GIS_PointTest extends PMA_GIS_GeomTest 'height' => 150 ), new TCPDF(), - ) + ) ); } - + /** * * @param type $spatial * @param type $label * @param type $line_color * @param type $scale_data - * @param type $output - * - *@dataProvider providerForPrepareRowAsSvg + * @param type $output + * + *@dataProvider providerForPrepareRowAsSvg */ - public function testPrepareRowAsSvg($spatial, $label, $line_color, $scale_data, $output) { - + public function testPrepareRowAsSvg($spatial, $label, $line_color, $scale_data, $output) + { + $this->assertEquals($output, $this->object->prepareRowAsSvg($spatial, $label, $line_color, $scale_data)); // $this->assertEquals($this->object->prepareRowAsSvg($spatial, $label, $line_color, $scale_data) , $output); } - + public function providerForPrepareRowAsSvg(){ - + return array( array( 'POINT(12 35)', @@ -271,7 +274,7 @@ class PMA_GIS_PointTest extends PMA_GIS_GeomTest 'height' => 150 ), '' - ) + ) ); } @@ -282,17 +285,18 @@ class PMA_GIS_PointTest extends PMA_GIS_GeomTest * @param type $label * @param type $line_color * @param type $scale_data - * @param type $output - * + * @param type $output + * *@dataProvider providerForPrepareRowAsOl */ - public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output) { - + public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output) + { + $this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data) , $output); } - + public function providerForPrepareRowAsOl(){ - + return array( array( 'POINT(12 35)', @@ -306,7 +310,7 @@ class PMA_GIS_PointTest extends PMA_GIS_GeomTest 'maxY' => '1', ), 'bound = new OpenLayers.Bounds(); bound.extend(new OpenLayers.LonLat(0, 0).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())); bound.extend(new OpenLayers.LonLat(1, 1).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));vectorLayer.addFeatures(new OpenLayers.Feature.Vector((new OpenLayers.Geometry.Point(12,35)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), null, {"pointRadius":3,"fillColor":"#ffffff","strokeColor":"#B02EE0","strokeWidth":2,"label":"Ol","labelYOffset":-8,"fontSize":10}));' - ) + ) ); } } diff --git a/test/classes/gis/PMA_GIS_Polygon_test.php b/test/classes/gis/PMA_GIS_Polygon_test.php index b0cebaa569..4176407f73 100644 --- a/test/classes/gis/PMA_GIS_Polygon_test.php +++ b/test/classes/gis/PMA_GIS_Polygon_test.php @@ -348,8 +348,8 @@ class PMA_GIS_PolygonTest extends PMA_GIS_GeomTest ), ); } - - + + /** * * @param type $spatial @@ -357,18 +357,19 @@ class PMA_GIS_PolygonTest extends PMA_GIS_GeomTest * @param type $line_color * @param type $scale_data * @param type $image - * @param type $output - * + * @param type $output + * *@dataProvider providerForPrepareRowAsPng */ - public function testPrepareRowAsPng($spatial, $label, $line_color, $scale_data, $image, $output) { - + public function testPrepareRowAsPng($spatial, $label, $line_color, $scale_data, $image, $output) + { + $return = $this->object->prepareRowAsPng($spatial, $label, $line_color, $scale_data, $image); $this->assertTrue(true); } - + public function providerForPrepareRowAsPng(){ - + return array( array( 'POLYGON((123 0,23 30,17 63,123 0))', @@ -383,7 +384,7 @@ class PMA_GIS_PolygonTest extends PMA_GIS_GeomTest imagecreatetruecolor('120','150'), '' ) - + ); } @@ -394,17 +395,18 @@ class PMA_GIS_PolygonTest extends PMA_GIS_GeomTest * @param type $line_color * @param type $scale_data * @param type $pdf - * + * *@dataProvider providerForPrepareRowAsPdf */ - public function testPrepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf) { - + public function testPrepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf) + { + $return = $this->object->prepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf); $this->assertTrue($return instanceof TCPDF); } - + public function providerForPrepareRowAsPdf(){ - + return array( array( 'POLYGON((123 0,23 30,17 63,123 0))', @@ -417,29 +419,30 @@ class PMA_GIS_PolygonTest extends PMA_GIS_GeomTest 'height' => 150 ), new TCPDF(), - ) + ) ); } - + /** * * @param type $spatial * @param type $label * @param type $line_color * @param type $scale_data - * @param type $output - * - *@dataProvider providerForPrepareRowAsSvg + * @param type $output + * + *@dataProvider providerForPrepareRowAsSvg */ - public function testPrepareRowAsSvg($spatial, $label, $line_color, $scale_data, $output) { - + public function testPrepareRowAsSvg($spatial, $label, $line_color, $scale_data, $output) + { + $string = $this->object->prepareRowAsSvg($spatial, $label, $line_color, $scale_data); $this->assertEquals(1, preg_match($output, $string)); // $this->assertEquals($this->object->prepareRowAsSvg($spatial, $label, $line_color, $scale_data) , $output); } - + public function providerForPrepareRowAsSvg(){ - + return array( array( 'POLYGON((123 0,23 30,17 63,123 0))', @@ -452,7 +455,7 @@ class PMA_GIS_PolygonTest extends PMA_GIS_GeomTest 'height' => 150 ), '/^()$/' - ) + ) ); } @@ -463,17 +466,18 @@ class PMA_GIS_PolygonTest extends PMA_GIS_GeomTest * @param type $label * @param type $line_color * @param type $scale_data - * @param type $output - * + * @param type $output + * *@dataProvider providerForPrepareRowAsOl */ - public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output) { - + public function testPrepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data, $output) + { + $this->assertEquals($this->object->prepareRowAsOl($spatial, $srid, $label, $line_color, $scale_data) , $output); } - + public function providerForPrepareRowAsOl(){ - + return array( array( 'POLYGON((123 0,23 30,17 63,123 0))', @@ -487,24 +491,25 @@ class PMA_GIS_PolygonTest extends PMA_GIS_GeomTest 'maxY' => '1', ), 'bound = new OpenLayers.Bounds(); bound.extend(new OpenLayers.LonLat(0, 0).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())); bound.extend(new OpenLayers.LonLat(1, 1).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));vectorLayer.addFeatures(new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon(new Array(new OpenLayers.Geometry.LinearRing(new Array((new OpenLayers.Geometry.Point(123,0)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(23,30)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(17,63)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geometry.Point(123,0)).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()))))), null, {"strokeColor":"#000000","strokeWidth":0.5,"fillColor":"#B02EE0","fillOpacity":0.8,"label":"Ol","fontSize":10}));' - ) + ) ); } /** * * @param type $ring - * @param type $output - * + * @param type $output + * *@dataProvider providerForIsOuterRing */ - public function testIsOuterRing($ring) { - + public function testIsOuterRing($ring) + { + $this->assertTrue($this->object->isOuterRing($ring)); } - + public function providerForIsOuterRing(){ - + return array( array( array( @@ -513,7 +518,7 @@ class PMA_GIS_PolygonTest extends PMA_GIS_GeomTest array('x' => 1, 'y' => 1), array('x' => 1, 'y' => 0) ), - ) + ) ); } }