summaryrefslogtreecommitdiffstats
path: root/pts-core/objects/pts_test_suite_details.php
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-11-17 14:00:36 -0500
committerMichael Larabel <michael@phx-laptop.(none)>2008-11-17 14:00:36 -0500
commit29031842c0ac7e48a4abc2384d55bd67ae202097 (patch)
treea5a493e2a59d343564ca5bcf1cb60ac05a910fc9 /pts-core/objects/pts_test_suite_details.php
parentab5a6d43cc446a18c8670ba4a222d7a4fb4f202d (diff)
downloadphoronix-test-suite-upstream-29031842c0ac7e48a4abc2384d55bd67ae202097.tar.gz
phoronix-test-suite-upstream-29031842c0ac7e48a4abc2384d55bd67ae202097.tar.xz
phoronix-test-suite-upstream-29031842c0ac7e48a4abc2384d55bd67ae202097.zip
pts-core: Branch out classes from pts-generic-classes.php
Diffstat (limited to 'pts-core/objects/pts_test_suite_details.php')
-rw-r--r--pts-core/objects/pts_test_suite_details.php106
1 files changed, 106 insertions, 0 deletions
diff --git a/pts-core/objects/pts_test_suite_details.php b/pts-core/objects/pts_test_suite_details.php
new file mode 100644
index 0000000..5b3d326
--- /dev/null
+++ b/pts-core/objects/pts_test_suite_details.php
@@ -0,0 +1,106 @@
+<?php
+
+/*
+ Phoronix Test Suite
+ URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
+ Copyright (C) 2008, Phoronix Media
+ Copyright (C) 2008, Michael Larabel
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+class pts_test_suite_details
+{
+ var $identifier;
+ var $identifier_show_prefix;
+ var $name;
+ var $maintainer;
+ var $description;
+ var $version;
+ var $type;
+ var $test_type;
+ var $unique_tests;
+ var $only_partially_supported = false;
+
+ public function __construct($identifier)
+ {
+ $xml_parser = new tandem_XmlReader(pts_location_suite($identifier));
+ $this->identifier = $identifier;
+ $this->name = $xml_parser->getXMLValue(P_SUITE_TITLE);
+ $this->test_type = $xml_parser->getXMLValue(P_SUITE_TYPE);
+ $this->version = $xml_parser->getXMLValue(P_SUITE_VERSION);
+ $this->type = $xml_parser->getXMLValue(P_SUITE_TYPE);
+ $this->maintainer = $xml_parser->getXMLValue(P_SUITE_MAINTAINER);
+ $this->description = $xml_parser->getXMLValue(P_SUITE_DESCRIPTION);
+ $this->unique_tests = count(pts_contained_tests($identifier));
+
+ $suite_support_code = pts_suite_supported($identifier);
+
+ $this->identifier_show_prefix = " ";
+ if($suite_support_code > 0)
+ {
+ if($suite_support_code == 1)
+ {
+ $this->identifier_show_prefix = "*";
+ $this->only_partially_supported = true;
+ }
+ }
+ }
+ public function partially_supported()
+ {
+ return $this->only_partially_supported;
+ }
+ public function info_string()
+ {
+ $str = "\n";
+
+ $suite_maintainer = explode("|", $this->maintainer);
+ if(count($suite_maintainer) == 2)
+ {
+ $suite_maintainer = trim($suite_maintainer[0]) . " <" . trim($suite_maintainer[1]) . ">";
+ }
+ else
+ {
+ $suite_maintainer = $suite_maintainer[0];
+ }
+
+ $str .= "Suite Version: " . $this->version . "\n";
+ $str .= "Maintainer: " . $this->maintainer . "\n";
+ $str .= "Suite Type: " . $this->test_type . "\n";
+ $str .= "Unique Tests: " . $this->unique_tests . "\n";
+ $str .= "Suite Description: " . $this->description . "\n";
+ $str .= "\n";
+
+ pts_print_format_tests($this->identifier, $str);
+
+ return $str;
+ }
+ public function __toString()
+ {
+ $str = "";
+
+ if(IS_DEBUG_MODE)
+ {
+ $str = sprintf("%-26ls - %-32ls %-4ls %-12ls\n", $this->identifier_show_prefix . " " . $this->identifier, $this->name, $this->version, $this->type);
+ }
+ else if(!empty($this->name))
+ {
+ $str = sprintf("%-24ls - %-32ls [Type: %s]\n", $this->identifier_show_prefix . " " . $this->identifier, $this->name, $this->test_type);
+ }
+
+ return $str;
+ }
+}
+
+?>