Best Phoronix-test-suite code snippet using pts_client.terminal_width
pts_concise_display_mode.php
Source:pts_concise_display_mode.php
...174 }175 break;176 }177 $expected_time = is_numeric($expected_time) && $expected_time > 0 ? pts_strings::format_time($expected_time, 'SECONDS', false, 60) : null;178 $terminal_width = pts_client::terminal_width();179 $download_size_string = $pts_test_file_download->get_filesize() > 0 ? ' [' . self::bytes_to_download_size($pts_test_file_download->get_filesize()) . 'MB]' : null;180 $download_string = $this->tab . $this->tab . pts_client::cli_just_bold($process_string) . ': ' . $pts_test_file_download->get_filename();181 if($terminal_width > 10 && strlen($download_string) + strlen($download_size_string) > $terminal_width)182 {183 $to_cut = (strlen($download_string) + strlen($download_size_string) + 1) - $terminal_width;184 $download_string = substr($download_string, 0, 0 - $to_cut) . '...';185 }186 $offset_length = $terminal_width > 1 ? $terminal_width : pts_test_file_download::$longest_file_name_length;187 $offset_length = $offset_length - strlen(pts_user_io::strip_ansi_escape_sequences($download_string)) - strlen($download_size_string) - 2;188 if($offset_length < 2)189 {190 $offset_length = 2;191 }192 $download_string .= str_repeat(' ', ($offset_length - 2));193 $download_string .= $download_size_string;194 echo $download_string . PHP_EOL;195 $this->progress_line_prefix = $expected_time != null ? 'Estimated Download Time: ' . $expected_time : $progress_prefix;196 $this->progress_last_float = -1;197 $this->progress_tab_count = 2;198 $this->progress_string_length = strlen(pts_user_io::strip_ansi_escape_sequences($download_string));199 }200 public function display_interrupt_message($message, $prefix_tag = 'NOTICE', $text_color = 'gray')201 {202 if($message == null)203 {204 return;205 }206 $terminal_width = pts_client::terminal_width() > 1 ? pts_client::terminal_width() : 80;207 $text_width = $terminal_width - (strlen($this->tab) * 3);208 echo PHP_EOL . $this->tab . $this->tab . pts_client::cli_colored_text(wordwrap(($prefix_tag != null ? '[' . $prefix_tag . '] ' : null) . $message, $text_width, PHP_EOL . $this->tab . $this->tab), $text_color, true) . PHP_EOL;209 }210 public function test_install_progress_start($process)211 {212 $this->progress_line_prefix = $process;213 $this->progress_last_float = -1;214 $this->progress_tab_count = 1;215 $this->progress_string_length = pts_client::terminal_width() > 1 ? pts_client::terminal_width() - 4 : 20;216 return;217 }218 public function test_install_progress_update($progress_float)219 {220 if($this->progress_last_float == -1)221 {222 $progress_prefix = str_repeat($this->tab, $this->progress_tab_count) . $this->progress_line_prefix . ' ';223 echo $progress_prefix;224 $this->progress_char_count = $this->progress_string_length - strlen($progress_prefix);225 $this->progress_char_pos = 0;226 }227 $char_current = floor($progress_float * $this->progress_char_count);228 if($char_current > $this->progress_char_pos && $char_current <= $this->progress_char_count)229 {230 echo str_repeat('.', $char_current - $this->progress_char_pos);231 $this->progress_char_pos = $char_current;232 }233 $this->progress_last_float = $progress_float; 234 }235 public function test_install_progress_completed()236 {237 $rep = $this->progress_char_count - $this->progress_char_pos;238 if($this->progress_last_float != -1 && $rep >= 0)239 {240 echo str_repeat('.', $rep) . PHP_EOL;241 }242 $this->progress_last_float == -1;243 }244 public function test_install_begin($test_install_request)245 {246 if(($size = $test_install_request->test_profile->get_environment_size(false)) > 0)247 {248 echo $this->tab . $this->tab . pts_client::cli_just_bold('Approximate Install Size: ') . $size . ' MB' . PHP_EOL;249 }250 if(($time = $test_install_request->test_profile->get_estimated_install_time()) > 1)251 {252 echo $this->tab . $this->tab . pts_client::cli_just_bold('Estimated Install Time: ') . pts_strings::format_time($time) . PHP_EOL;253 }254 echo $this->tab . $this->tab . 'Installing Test' . ' @ ' . date('H:i:s') . PHP_EOL;255 return;256 }257 public function test_install_output(&$to_output)258 {259 return;260 }261 public function test_install_message($msg_string)262 {263 echo $this->tab . $this->tab . pts_client::cli_colored_text($msg_string, 'green', true) . PHP_EOL;264 }265 public function test_install_error($error_string)266 {267 echo $this->tab . $this->tab . $this->tab . pts_client::cli_colored_text($error_string, 'red', true) . PHP_EOL;268 }269 public function test_install_prompt($prompt_string)270 {271 echo $this->tab . $this->tab . $this->tab . $prompt_string;272 }273 public function test_run_process_start(&$test_run_manager)274 {275 return;276 }277 public function test_run_configure(&$test_profile)278 {279 echo PHP_EOL . PHP_EOL . $test_profile->get_title() . ($test_profile->get_app_version() != null ? ' ' . $test_profile->get_app_version() : null) . ':' . PHP_EOL . $this->tab . $test_profile->get_identifier() . PHP_EOL;280 echo $this->tab . $test_profile->get_test_hardware_type() . ' Test Configuration';281 //echo PHP_EOL;282 //echo $this->tab . 'Test ' . $test_run_manager->get_test_run_position() . ' of ' . $test_run_manager->get_test_run_count_reported() . PHP_EOL;283 }284 public function test_run_start(&$test_run_manager, &$test_result)285 {286 $this->current_saved_test_identifier = $test_run_manager->get_results_identifier();287 $this->current_test = $test_result->test_profile->get_identifier();288 $test_title_string = $test_result->test_profile->get_title() . ($test_result->test_profile->get_app_version() != null ? ' ' . $test_result->test_profile->get_app_version() : null) . ':' . PHP_EOL . $this->tab . $test_result->test_profile->get_identifier();289 if(($test_description = $test_result->get_arguments_description()) != false)290 {291 $test_title_string .= ' [' . pts_client::swap_variables($test_description, array('pts_client', 'environmental_variables')) . ']';292 }293 echo PHP_EOL . pts_client::cli_colored_text($test_title_string, 'cyan', true) . PHP_EOL;294 echo $this->tab . 'Test ' . $test_run_manager->get_test_run_position() . ' of ' . $test_run_manager->get_test_run_count_reported() . PHP_EOL;295 $this->trial_run_count_current = 0;296 $this->expected_trial_run_count = $test_result->test_profile->get_times_to_run();297 $remaining_length = $test_run_manager->get_estimated_run_time();298 $estimated_length = $test_result->get_estimated_run_time();299 $display_table = array();300 if($test_result->test_profile->get_status() != 'Verified' && $test_result->test_profile->get_status() != '')301 {302 array_push($display_table, array($this->tab . 'Test Profile Status:', pts_client::cli_just_italic($test_result->test_profile->get_status())));303 }304 array_push($display_table, array($this->tab . 'Estimated Trial Run Count:', $this->expected_trial_run_count));305 if($estimated_length > 1 && $estimated_length != $remaining_length)306 {307 array_push($display_table, array($this->tab . 'Estimated Test Run-Time:', pts_strings::format_time($estimated_length, 'SECONDS', true, 60)));308 }309 if($remaining_length > 1)310 {311 $est_end_time = null;312 if((time() % 86400) + $remaining_length > 86400)313 {314 // If test run is past current calendar date315 $est_end_time = date(' [H:i T M j]', time() + $remaining_length);316 }317 else318 {319 $est_end_time = date(' [H:i T]', time() + $remaining_length);320 }321 array_push($display_table, array($this->tab . 'Estimated Time To Completion:', pts_strings::format_time($remaining_length, 'SECONDS', true, 60) . $est_end_time));322 }323 echo pts_user_io::display_text_table($display_table);324 if($test_result->pre_run_message != null)325 {326 foreach(pts_arrays::to_array($test_result->pre_run_message) as $l)327 {328 echo PHP_EOL . $this->tab . pts_client::cli_just_italic($l);329 }330 $test_result->pre_run_message = null;331 }332 }333 public function test_run_message($message_string)334 {335 echo PHP_EOL . $this->tab . $this->tab . $message_string . ' @ ' . date('H:i:s');336 }337 public function test_run_instance_header(&$test_result)338 {339 $this->trial_run_count_current++;340 echo PHP_EOL . $this->tab . $this->tab . 'Started Run ' . $this->trial_run_count_current . ' @ ' . date('H:i:s');341 if($this->expected_trial_run_count > 1 && $this->trial_run_count_current > $this->expected_trial_run_count)342 {343 // add a mark since the results are in overtime, deviation likely too high and run count increased344 echo ' *';345 }346 }347 public function test_run_instance_error($error_string)348 {349 echo PHP_EOL . $this->tab . $this->tab . pts_client::cli_colored_text($error_string, 'red', true);350 }351 public function test_run_instance_output(&$to_output)352 {353 if(pts_client::is_debug_mode())354 {355 echo $to_output;356 }357 return;358 }359 public function test_run_instance_complete(&$result)360 {361 return; // if anything to append to string of "Started Run"362 }363 public function test_run_end(&$test_result)364 {365 echo PHP_EOL;366 if(in_array($test_result->test_profile->get_display_format(), array('NO_RESULT', 'IMAGE_COMPARISON')))367 {368 $end_print = null;369 }370 else if(in_array($test_result->test_profile->get_display_format(), array('PASS_FAIL', 'MULTI_PASS_FAIL')))371 {372 if($test_result->test_profile->get_result_scale())373 {374 $rs = ' (' . $test_result->test_profile->get_result_scale() . ')';375 }376 else377 {378 $rs = null;379 }380 $end_print = $this->tab . $this->tab . 'Final: ' . $test_result->active->get_result() . $rs . PHP_EOL;381 }382 else if(in_array($test_result->test_profile->get_display_format(), array('FILLED_LINE_GRAPH', 'LINE_GRAPH')))383 {384 $values = explode(',', $test_result->active->get_result());385 $end_print = PHP_EOL . $this->tab . ($test_result->get_arguments_description() ? $test_result->get_arguments_description() : 'Test Results') . ':' . PHP_EOL;386 if($test_result->test_profile->get_result_proportion() == 'LIB')387 {388 $minimum_color = 'green';389 $maximum_color = 'red';390 }391 else if($test_result->test_profile->get_result_proportion() == 'HIB')392 {393 $minimum_color = 'red';394 $maximum_color = 'green';395 }396 if(count($values) > 1)397 {398 $avg = pts_math::set_precision(pts_math::arithmetic_mean($values), 2);399 $min = pts_math::set_precision(min($values), 2);400 $max = pts_math::set_precision(max($values), 2);401 $end_print .= $this->tab . 'Average: ' . pts_client::cli_colored_text($avg, 'blue', true) . ' ' . $test_result->test_profile->get_result_scale() . PHP_EOL;402 $end_print .= $this->tab . 'Minimum: ' . pts_client::cli_colored_text($min, $minimum_color, true) . ' ' . $test_result->test_profile->get_result_scale() . PHP_EOL;403 $end_print .= $this->tab . 'Maximum: ' . pts_client::cli_colored_text($max, $maximum_color, true) . ' ' . $test_result->test_profile->get_result_scale() . PHP_EOL;404 }405 }406 else407 {408 $end_print = PHP_EOL . $this->tab . ($test_result->get_arguments_description() ? $test_result->get_arguments_description() : 'Test Results') . ':' . PHP_EOL;409 $result_count = 0;410 if($test_result->test_profile->get_result_proportion() == 'LIB')411 {412 $best_result = $test_result->active->get_min_value();413 $worst_result = $test_result->active->get_max_value();414 }415 else if($test_result->test_profile->get_result_proportion() == 'HIB')416 {417 $best_result = $test_result->active->get_max_value();418 $worst_result = $test_result->active->get_min_value();419 }420 foreach($test_result->active->results as $result)421 {422 $text_color = null;423 if(count($test_result->active->results) > 1)424 {425 if($result == $best_result)426 {427 $text_color = 'green';428 }429 else if($result == $worst_result)430 {431 $text_color = 'red';432 }433 }434 $end_print .= $this->tab . $this->tab . pts_client::cli_colored_text($result, $text_color, true) . PHP_EOL;435 $result_count++;436 }437 $end_print .= PHP_EOL . $this->tab . pts_strings::result_quantifier_to_string($test_result->test_profile->get_result_quantifier()) . ': ' . pts_client::cli_colored_text($test_result->active->get_result() . ' ' . $test_result->test_profile->get_result_scale(), 'blue', true);438 if($test_result->active->get_min_result())439 {440 $end_print .= PHP_EOL . $this->tab . 'Minimum: ' . $test_result->active->get_min_result();441 }442 if($test_result->active->get_max_result())443 {444 $end_print .= PHP_EOL . $this->tab . 'Maximum: ' . $test_result->active->get_max_result();445 }446 if($result_count > 2)447 {448 $end_print .= PHP_EOL . $this->tab . 'Deviation: ' . pts_math::set_precision(pts_math::percent_standard_deviation($test_result->active->results), 2) . '%';449 }450 if(count($test_result->active->results) != $test_result->test_profile->get_default_times_to_run())451 {452 $end_print .= PHP_EOL . $this->tab . 'Samples: ' . count($test_result->active->results);453 }454 if($test_result->active->get_result() == 0)455 {456 $end_print .= PHP_EOL . $this->tab . 'This test failed to run properly.';457 }458 $end_print .= PHP_EOL;459 }460 echo $end_print;461 }462 public function test_run_success_inline($test_result_orig)463 {464 if($test_result_orig->test_result_buffer->get_count() < 2)465 {466 return;467 }468 $test_result = clone $test_result_orig;469 $test_result->sort_results_by_performance();470 $test_result->test_result_buffer->buffer_values_reverse();471 echo pts_result_file_output::test_result_to_text($test_result, pts_client::terminal_width(), true, $this->current_saved_test_identifier, ($test_result->test_profile->get_identifier() == null || $this->current_test != $test_result->test_profile->get_identifier()));472 echo PHP_EOL;473 }474 public function test_run_error($error_string)475 {476 echo PHP_EOL . $this->tab . $this->tab . pts_client::cli_colored_text($error_string, 'red', true) . PHP_EOL;477 }478 public function generic_prompt($prompt_string)479 {480 echo $this->tab . $prompt_string;481 }482 public function generic_heading($string, $ending_line_break = true)483 {484 static $shown_pts = false;485 if($shown_pts == false)...
terminal_width
Using AI Code Generation
1echo $client->terminal_width();2echo $client->terminal_height();3echo $client->terminal_size();4echo $client->terminal_size();5echo $client->terminal_size();6echo $client->terminal_size();7echo $client->terminal_size();8echo $client->terminal_size();9echo $client->terminal_size();10echo $client->terminal_size();11echo $client->terminal_size();12echo $client->terminal_size();13echo $client->terminal_size();14echo $client->terminal_size();15echo $client->terminal_size();16echo $client->terminal_size();17echo $client->terminal_size();18echo $client->terminal_size();19echo $client->terminal_size();
terminal_width
Using AI Code Generation
1require_once 'pts_client.php';2$terminal_width = pts_client::terminal_width();3echo "Terminal Width: ".$terminal_width;4require_once 'pts_client.php';5$terminal_height = pts_client::terminal_height();6echo "Terminal Height: ".$terminal_height;7require_once 'pts_client.php';8$terminal_width = pts_client::terminal_width();9echo "Terminal Width: ".$terminal_width;10require_once 'pts_client.php';11$terminal_height = pts_client::terminal_height();12echo "Terminal Height: ".$terminal_height;13require_once 'pts_client.php';14$terminal_width = pts_client::terminal_width();15echo "Terminal Width: ".$terminal_width;16require_once 'pts_client.php';17$terminal_height = pts_client::terminal_height();18echo "Terminal Height: ".$terminal_height;19require_once 'pts_client.php';20$terminal_width = pts_client::terminal_width();21echo "Terminal Width: ".$terminal_width;22require_once 'pts_client.php';23$terminal_height = pts_client::terminal_height();24echo "Terminal Height: ".$terminal_height;25require_once 'pts_client.php';26$terminal_width = pts_client::terminal_width();27echo "Terminal Width: ".$terminal_width;28require_once 'pts_client.php';29$terminal_height = pts_client::terminal_height();30echo "Terminal Height: ".$terminal_height;31require_once 'pts_client.php';32$terminal_width = pts_client::terminal_width();33echo "Terminal Width: ".$terminal_width;
terminal_width
Using AI Code Generation
1require_once('pts_client.php');2$terminal_width = pts_client::terminal_width();3";4require_once('pts_client.php');5$terminal_height = pts_client::terminal_height();6";7require_once('pts_client.php');8$terminal_width = pts_client::terminal_width();9";10require_once('pts_client.php');11$terminal_height = pts_client::terminal_height();12";13require_once('pts_client.php');14$terminal_width = pts_client::terminal_width();15";16require_once('pts_client.php');17$terminal_height = pts_client::terminal_height();18";19require_once('pts_client.php');20$terminal_width = pts_client::terminal_width();21";22require_once('pts_client.php');23$terminal_height = pts_client::terminal_height();24";25require_once('pts_client.php');26$terminal_width = pts_client::terminal_width();27";28require_once('pts_client.php');
terminal_width
Using AI Code Generation
1$width= $client->terminal_width();2";3$height= $client->terminal_height();4";5$size= $client->terminal_size();6";7$client->terminal_size(100, 100);8$client->terminal_size("100x100");9$client->terminal_size("100x100+100+100");10$client->terminal_size("100x100-100-100");11$client->terminal_size("100x100+100-100");12$client->terminal_size("100x100-100+100");13$client->terminal_size("100x100+100+100-100-100");14$client->terminal_size("100x100-100-100+100+100");15$client->terminal_size("100x100+100-100+100+100
terminal_width
Using AI Code Generation
1$terminal_width = $pts_client->terminal_width();2echo $terminal_width;3$terminal_height = $pts_client->terminal_height();4echo $terminal_height;5$terminal_size = $pts_client->terminal_size();6echo $terminal_size;7$terminal_type = $pts_client->terminal_type();8echo $terminal_type;9$terminal_type = $pts_client->terminal_type();10echo $terminal_type;11$terminal_type = $pts_client->terminal_type();12echo $terminal_type;13$terminal_type = $pts_client->terminal_type();14echo $terminal_type;15$terminal_type = $pts_client->terminal_type();16echo $terminal_type;
terminal_width
Using AI Code Generation
1require_once('pts_client.php');2$width = pts_client::terminal_width();3";4require_once('pts_client.php');5$width = pts_client::terminal_width();6";7require_once('pts_client.php');8$width = pts_client::terminal_width();9";10require_once('pts_client.php');11$width = pts_client::terminal_width();12";13require_once('pts_client.php');14$width = pts_client::terminal_width();15";
terminal_width
Using AI Code Generation
1require_once 'pts_client.php';2$width = pts_client::terminal_width();3echo str_repeat('=', $width) . "4";5";6echo str_repeat('=', $width) . "7";
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with terminal_width on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!