本文整理汇总了PHP中pts_client::save_result_file方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_client::save_result_file方法的具体用法?PHP pts_client::save_result_file怎么用?PHP pts_client::save_result_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pts_client
的用法示例。
在下文中一共展示了pts_client::save_result_file方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_execution_process
public function post_execution_process()
{
if ($this->do_save_results()) {
if ($this->result_file_writer->get_result_count() == 0 && !pts_result_file::is_test_result_file($this->get_file_name()) && pts_c::$test_flags ^ pts_c::is_recovering && pts_c::$test_flags ^ pts_c::remote_mode) {
pts_file_io::delete(PTS_SAVE_RESULTS_PATH . $this->get_file_name());
return false;
}
pts_file_io::delete(PTS_SAVE_RESULTS_PATH . $this->get_file_name() . '/test-logs/active/', null, true);
if (pts_c::$test_flags ^ pts_c::is_recovering && (!pts_result_file::is_test_result_file($this->get_file_name()) || $this->result_already_contains_identifier() == false)) {
$this->result_file_writer->add_test_notes(pts_test_notes_manager::generate_test_notes($this->tests_to_run), $this->generate_json_system_attributes());
}
echo PHP_EOL;
pts_module_manager::module_process('__event_results_process', $this);
pts_client::save_result_file($this->result_file_writer, $this->get_file_name());
pts_module_manager::module_process('__event_results_saved', $this);
//echo PHP_EOL . 'Results Saved To: ; . PTS_SAVE_RESULTS_PATH . $this->get_file_name() . ;/composite.xml' . PHP_EOL;
if (!(pts_c::$test_flags & pts_c::auto_mode)) {
if (pts_c::$test_flags & pts_c::batch_mode) {
if (self::$batch_mode_options['OpenBrowser']) {
pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $this->get_file_name() . '/index.html', null, true, true);
}
} else {
pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $this->get_file_name() . '/index.html', null, true, false);
}
}
if ($this->allow_sharing_of_results && pts_network::internet_support_available()) {
if ($this->auto_upload_to_openbenchmarking || pts_openbenchmarking_client::auto_upload_results() || pts_flags::upload_to_openbenchmarking()) {
$upload_results = true;
} else {
if (pts_c::$test_flags & pts_c::batch_mode) {
$upload_results = self::$batch_mode_options['UploadResults'];
} else {
if (!(pts_c::$test_flags & pts_c::auto_mode)) {
$upload_results = pts_user_io::prompt_bool_input('Would you like to upload the results to OpenBenchmarking.org', true);
} else {
$upload_results = false;
}
}
}
if ($upload_results) {
$this->openbenchmarking_results_data = pts_openbenchmarking::upload_test_result($this, true);
if ($this->get_results_url()) {
if (!(pts_c::$test_flags & pts_c::auto_mode) && pts_openbenchmarking_client::auto_upload_results() == false) {
pts_client::display_web_page($this->get_results_url(), 'Do you want to launch OpenBenchmarking.org', true);
}
} else {
echo PHP_EOL . 'Results Failed To Upload.' . PHP_EOL;
}
}
}
}
}
示例2: run
public static function run($args)
{
$result = $args[0];
$result_file = new pts_result_file($result);
$result_file_identifiers = $result_file->get_system_identifiers();
if (count($result_file_identifiers) < 2) {
echo PHP_EOL . 'There are not multiple test runs in this result file.' . PHP_EOL;
return false;
}
$base_identifier = pts_user_io::prompt_text_menu('Select the base test run', $result_file_identifiers);
$base_select = new pts_result_merge_select($result, $base_identifier);
$compare_identifier = pts_user_io::prompt_text_menu('Select the test run to compare', $result_file_identifiers);
$compare_select = new pts_result_merge_select($result, $compare_identifier);
do {
$extract_to = 'iqc-analyze-' . rand(100, 999);
} while (is_dir(PTS_SAVE_RESULTS_PATH . $extract_to));
$extract_result = pts_merge::merge_test_results($base_select, $compare_select);
pts_client::save_test_result($extract_to . '/composite.xml', $extract_result);
$compare_file = new pts_result_file($extract_to);
$result_file_writer = new pts_result_file_writer('Image Delta');
foreach ($compare_file->get_result_objects() as $result_object) {
if ($result_object->test_profile->get_display_format() != 'IMAGE_COMPARISON') {
continue;
}
$base_result = null;
$compare_result = null;
foreach ($result_object->test_result_buffer->get_buffer_items() as $buffer_item) {
if ($buffer_item->get_result_identifier() == $base_identifier && $base_result == null) {
$base_result = $buffer_item->get_result_value();
} else {
if ($buffer_item->get_result_identifier() == $compare_identifier && $compare_result == null) {
$compare_result = $buffer_item->get_result_value();
}
}
if ($compare_result != null && $base_result != null) {
break;
}
}
if ($compare_result == null || $base_result == null) {
continue;
}
$base_img = imagecreatefromstring(base64_decode($base_result));
$compare_img = imagecreatefromstring(base64_decode($compare_result));
$delta_img = imagecreatefromstring(base64_decode($compare_result));
$img_width = imagesx($base_img);
$img_height = imagesy($base_img);
$img_changed = false;
for ($x = 0; $x < $img_width; $x++) {
for ($y = 0; $y < $img_height; $y++) {
$base_image_color = pts_image::rgb_gd_color_at($base_img, $x, $y);
$compare_image_color = pts_image::rgb_gd_color_at($compare_img, $x, $y);
if ($base_image_color == $compare_image_color || pts_image::rgb_int_diff($base_image_color, $compare_image_color) < 9) {
if ($cords = pts_image::color_pixel_delta($base_img, $compare_img, $x, $y)) {
$pixel_rgb = pts_image::rgb_gd_color_at($delta_img, $cords[0], $cords[1]);
$color_invert = imagecolorresolve($delta_img, 255 - $pixel_rgb[0], 255 - $pixel_rgb[1], 255 - $pixel_rgb[2]);
imagesetpixel($delta_img, $x, $y, $color_invert);
$img_changed = true;
}
}
}
}
if ($img_changed) {
imagepng($delta_img, PTS_SAVE_RESULTS_PATH . $extract_to . '/scratch.png');
$result_value = base64_encode(file_get_contents(PTS_SAVE_RESULTS_PATH . $extract_to . '/scratch.png', FILE_BINARY));
pts_file_io::unlink(PTS_SAVE_RESULTS_PATH . $extract_to . '/scratch.png');
$result_file_writer->add_result_from_result_object_with_value_string($result_object, $result_value);
}
}
pts_client::save_result_file($result_file_writer, $extract_to);
pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $extract_to . '/composite.xml');
}