Пример #1
0
 /**
  * Tests getValue() method.
  */
 public function testGetValue()
 {
     $this->assertEquals(false, MantisEnum::getValue(MantisEnumTest::EMPTY_ENUM, 'viewer'));
     $this->assertEquals(10, MantisEnum::getValue(MantisEnumTest::SINGLE_VALUE_ENUM, 'viewer'));
     $this->assertEquals(10, MantisEnum::getValue(MantisEnumTest::DUPLICATE_VALUES_ENUM, 'viewer1'));
     $this->assertEquals(20, MantisEnum::getValue(MantisEnumTest::NAME_WITH_SPACES_ENUM, 'second label'));
     // This is not inconsisent with duplicate values behavior, however, it is considered correct since it simplies the code
     // and it is not a real scenario.
     $this->assertEquals(20, MantisEnum::getValue(MantisEnumTest::DUPLICATE_LABELS_ENUM, 'viewer'));
 }
Пример #2
0
/**
 * Get the enum id given the enum label.
 *
 * @param $p_enum_string   The enum string to search in.
 * @param $p_label         The label to search for.
 *
 * @return The id corresponding to the given label, or 0 if not found.
 */
function mci_get_enum_value_from_label($p_enum_string, $p_label)
{
    $t_value = MantisEnum::getValue($p_enum_string, $p_label);
    if ($t_value === false) {
        return 0;
    }
    return $t_value;
}
Пример #3
0
		<td class="scrumcolumn" width="<?php 
    echo $bug_count > 0 ? $bug_percentage_by_column[$column] : $bug_percentage_by_column;
    ?>
%">
<?php 
    foreach ($statuses as $status) {
        if (isset($bugs[$status]) || plugin_config_get('show_empty_status')) {
            if ($first) {
                $first = false;
            } else {
                ?>
			<hr />
<?php 
            }
            # Display status name only if different from column header
            $column_enum_val = MantisEnum::getValue($status_enum, $column);
            if ($column_enum_val != $status) {
                ?>
			<p class="scrumstatus">
				<?php 
                echo get_enum_element('status', $status);
                ?>
			</p><?php 
            }
            if (isset($bugs[$status])) {
                foreach ($bugs[$status] as $bug) {
                    $sevcolor = array_key_exists($bug->severity, $sevcolors) ? $sevcolors[$bug->severity] : 'white';
                    $rescolor = array_key_exists($bug->resolution, $rescolors) ? $rescolors[$bug->resolution] : 'white';
                    ?>
			<div class="scrumblock">
				<p class="priority"><?php