aboutsummaryrefslogtreecommitdiffstats
path: root/it/2
diff options
context:
space:
mode:
authorYuri Chornoivan <yurchor@ukr.net>2019-07-13 12:26:29 +0300
committerYuri Chornoivan <yurchor@ukr.net>2019-07-13 12:26:29 +0300
commit7f4f5f86754d7cde55dcaf31913b182ad3e3f746 (patch)
tree7dd14437f7e05f94ee43417c3a0f8c9a979e00ac /it/2
parent06825f04e69e545296256e3f9642a3788b7915e8 (diff)
downloadwww-7f4f5f86754d7cde55dcaf31913b182ad3e3f746.tar
www-7f4f5f86754d7cde55dcaf31913b182ad3e3f746.tar.gz
www-7f4f5f86754d7cde55dcaf31913b182ad3e3f746.tar.bz2
www-7f4f5f86754d7cde55dcaf31913b182ad3e3f746.tar.xz
www-7f4f5f86754d7cde55dcaf31913b182ad3e3f746.zip
Update Japanese translation
Diffstat (limited to 'it/2')
0 files changed, 0 insertions, 0 deletions
a> 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is Everything Solved, Inc.
# Portions created by the Initial Developer are Copyright (C) 2010 the
# Initial Developer. All Rights Reserved.
#
# Contributor(s):
#   Max Kanat-Alexander <mkanat@bugzilla.org>

# This module tests Bugzilla/Search.pm. It uses various constants
# that are in Bugzilla::Test::Search::Constants, in xt/lib/.
#
# It does this by:
# 1) Creating a bunch of field values. Each field value is
#    randomly named and fully unique.
# 2) Creating a bunch of bugs that use those unique field
#    values. Each bug has different characteristics--see
#    the comment above the NUM_BUGS constant for a description
#    of each bug.
# 3) Running searches using the combination of every search operator against
#    every field. The tests that we run are described by the TESTS constant.
#    Some of the operator/field combinations are known to be broken--
#    these are listed in the KNOWN_BROKEN constant.
# 4) For each search, we make sure that certain bugs are contained in
#    the search, and certain other bugs are not contained in the search.
#    The code for the operator/field tests is mostly in
#    Bugzilla::Test::Search::FieldTest.
# 5) After testing each operator/field combination's functionality, we
#    do additional tests to make sure that there are no SQL injections
#    possible via any operator/field combination. The code for the
#    SQL Injection tests is in Bugzilla::Test::Search::InjectionTest.
#
# Generally, the only way that you should modify the behavior of this
# script is by modifying the constants.

package Bugzilla::Test::Search;

use strict;
use warnings;
use Bugzilla::Attachment;
use Bugzilla::Bug ();
use Bugzilla::Constants;
use Bugzilla::Field;
use Bugzilla::Field::Choice;
use Bugzilla::FlagType;
use Bugzilla::Group;
use Bugzilla::Install ();
use Bugzilla::Test::Search::Constants;
use Bugzilla::Test::Search::CustomTest;
use Bugzilla::Test::Search::FieldTestNormal;
use Bugzilla::Test::Search::OperatorTest;
use Bugzilla::User ();
use Bugzilla::Util qw(generate_random_password);

use Carp;
use DateTime;
use Scalar::Util qw(blessed);

###############
# Constructor #
###############

sub new {
    my ($class, $options) = @_;
    return bless { options => $options }, $class;
}

#############
# Accessors #
#############

sub options { return $_[0]->{options} }
sub option { return $_[0]->{options}->{$_[1]} }

sub num_tests {
    my ($self) = @_;
    my @top_operators = $self->top_level_operators;
    my @all_operators = $self->all_operators;
    my $top_operator_tests = $self->_total_operator_tests(\@top_operators);
    my $all_operator_tests = $self->_total_operator_tests(\@all_operators);

    my @fields = $self->all_fields;

    # Basically, we run TESTS_PER_RUN tests for each field/operator combination.
    my $top_combinations = $top_operator_tests * scalar(@fields);
    my $all_combinations = $all_operator_tests * scalar(@fields);
    # But we also have ORs, for which we run combinations^2 tests.
    my $join_tests = $self->option('long')
                     ? ($top_combinations * $all_combinations) : 0;
    # And AND tests, which means we run 2x $join_tests;
    $join_tests = $join_tests * 2;
    # Also, because of NOT tests and Normal tests, we run 3x $top_combinations.
    my $basic_tests = $top_combinations * 3;
    my $operator_field_tests = ($basic_tests + $join_tests) * TESTS_PER_RUN;

    # Then we test each field/operator combination for SQL injection.
    my @injection_values = INJECTION_TESTS;
    my $sql_injection_tests = scalar(@fields) * scalar(@top_operators)
                              * scalar(@injection_values) * NUM_SEARCH_TESTS;

    # This @{ [] } thing is the only reasonable way to get a count out of a
    # constant array.
    my $special_tests = scalar(@{ [SPECIAL_PARAM_TESTS, CUSTOM_SEARCH_TESTS] }) 
                        * TESTS_PER_RUN;
    
    return $operator_field_tests + $sql_injection_tests + $special_tests;
}

sub _total_operator_tests {
    my ($self, $operators) = @_;
    
    # Some operators have more than one test. Find those ones and add
    # them to the total operator tests
    my $extra_operator_tests;
    foreach my $operator (@$operators) {
        my $tests = TESTS->{$operator};
        next if !$tests;
        my $extra_num = scalar(@$tests) - 1;
        $extra_operator_tests += $extra_num;
    }
    return scalar(@$operators) + $extra_operator_tests;
    
}

sub all_operators {
    my ($self) = @_;
    if (not $self->{all_operators}) {
        
        my @operators;
        if (my $limit_operators = $self->option('operators')) {
            @operators = split(',', $limit_operators);
        }
        else {
            @operators = sort (keys %{ Bugzilla::Search::OPERATORS() });
        }
        # "substr" is just a backwards-compatibility operator, same as "substring".
        @operators = grep { $_ ne 'substr' } @operators;
        $self->{all_operators} = \@operators;
    }
    return @{ $self->{all_operators} };
}

sub all_fields {
    my $self = shift;
    if (not $self->{all_fields}) {
        $self->_create_custom_fields();
        my @fields = @{ Bugzilla->fields };
        @fields = sort { $a->name cmp $b->name } @fields;
        $self->{all_fields} = \@fields;
    }
    return @{ $self->{all_fields} };
}

sub top_level_operators {
    my ($self) = @_;
    if (!$self->{top_level_operators}) {
        my @operators;
        my $limit_top = $self->option('top-operators');
        if ($limit_top) {
            @operators = split(',', $limit_top);
        }
        else {
            @operators = $self->all_operators;
        }
        $self->{top_level_operators} = \@operators;
    }
    return @{ $self->{top_level_operators} };
}

sub text_fields {
    my ($self) = @_;
    my @text_fields = grep { $_->type == FIELD_TYPE_TEXTAREA
                             or $_->type == FIELD_TYPE_FREETEXT } $self->all_fields;
    @text_fields = map { $_->name } @text_fields;
    push(@text_fields, qw(short_desc status_whiteboard bug_file_loc see_also));
    return @text_fields;
}

sub bugs {
    my $self = shift;
    $self->{bugs} ||= [map { $self->_create_one_bug($_) } (1..NUM_BUGS)];
    return @{ $self->{bugs} };
}

# Get a numbered bug.
sub bug {
    my ($self, $number) = @_;
    return ($self->bugs)[$number - 1];
}

sub admin {
    my $self = shift;
    if (!$self->{admin_user}) {
        my $admin = create_user("admin");
        Bugzilla::Install::make_admin($admin);
        $self->{admin_user} = $admin;
    }
    # We send back a fresh object every time, to make sure that group
    # memberships are always up-to-date.
    return new Bugzilla::User($self->{admin_user}->id);
}

sub nobody {
    my $self = shift;
    $self->{nobody} ||= Bugzilla::Group->create({ name => "nobody-" . random(),
        description => "Nobody", isbuggroup => 1 });
    return $self->{nobody};
}
sub everybody {
    my ($self) = @_;
    $self->{everybody} ||= create_group('To The Limit');
    return $self->{everybody};
}

sub bug_create_value {
    my ($self, $number, $field) = @_;
    $field = $field->name if blessed($field);
    if ($number == 6 and $field ne 'alias') {
        $number = 1;
    }
    my $extra_values = $self->_extra_bug_create_values->{$number};
    if (exists $extra_values->{$field}) {
        return $extra_values->{$field};
    }
    return $self->_bug_create_values->{$number}->{$field};
}
sub bug_update_value {
    my ($self, $number, $field) = @_;
    $field = $field->name if blessed($field);
    if ($number == 6 and $field ne 'alias') {
        $number = 1;
    }
    return $self->_bug_update_values->{$number}->{$field};
}

# Values used to create the bugs.
sub _bug_create_values {
    my $self = shift;
    return $self->{bug_create_values} if $self->{bug_create_values};
    my %values;
    foreach my $number (1..NUM_BUGS) {
        $values{$number} = $self->_create_field_values($number, 'for create');
    }
    $self->{bug_create_values} = \%values;
    return $self->{bug_create_values};
}
# Values as they existed on the bug, at creation time. Used by the
# changedfrom tests.
sub _extra_bug_create_values {
    my $self = shift;
    $self->{extra_bug_create_values} ||= { map { $_ => {} } (1..NUM_BUGS) };
    return $self->{extra_bug_create_values};
}

# Values used to update the bugs after they are created.
sub _bug_update_values {
    my $self = shift;
    return $self->{bug_update_values} if $self->{bug_update_values};
    my %values;
    foreach my $number (1..NUM_BUGS) {
        $values{$number} = $self->_create_field_values($number);
    }
    $self->{bug_update_values} = \%values;
    return $self->{bug_update_values};
}

##############################
# General Helper Subroutines #
##############################

sub random {
    $_[0] ||= FIELD_SIZE;
    generate_random_password(@_);
}

# We need to use a custom timestamp for each create() and update(),
# because the database returns the same value for LOCALTIMESTAMP(0)
# for the entire transaction, and we need each created bug to have
# its own creation_ts and delta_ts.
sub timestamp {
    my ($day, $second) = @_;
    return DateTime->new(
        year   => 2037,
        month  => 1,
        day    => $day,
        hour   => 12,
        minute => $second,
        second => 0,
        # We make it floating because the timezone doesn't matter for our uses,
        # and we want totally consistent behavior across all possible machines.
        time_zone => 'floating',
    );
}

sub create_keyword {
    my ($number) = @_;
    return Bugzilla::Keyword->create({
        name => "$number-keyword-" . random(),
        description => "Keyword $number" });
}

sub create_user {
    my ($prefix) = @_;
    my $user_name = $prefix . '-' . random(15) . "@" . random(12)
                    . "." . random(3);
    my $user_realname = $prefix . '-' . random();
    my $user = Bugzilla::User->create({
        login_name => $user_name,
        realname   => $user_realname,
        cryptpassword => '*',
    });
    return $user;
}

sub create_group {
    my ($prefix) = @_;
    return Bugzilla::Group->create({
        name => "$prefix-group-" . random(), description => "Everybody $prefix",
        userregexp => '.*', isbuggroup => 1 });
}

sub create_legal_value {
    my ($field, $number) = @_;
    my $type = Bugzilla::Field::Choice->type($field);
    my $field_name = $field->name;
    return $type->create({ value => "$number-$field_name-" . random(),
                           is_open => 0 });
}

#########################
# Custom Field Creation #
#########################

sub _create_custom_fields {
    my ($self) = @_;
    return if !$self->option('add-custom-fields');
    
    while (my ($type, $name) = each %{ CUSTOM_FIELDS() }) {
        my $exists = new Bugzilla::Field({ name => $name });
        next if $exists;
        Bugzilla::Field->create({
            name => $name,
            type => $type,
            description => "Search Test Field $name",
            enter_bug => 1,
            custom => 1,
            buglist => 1,
            is_mandatory => 0,
        });
    }
}

########################
# Field Value Creation #
########################

sub _create_field_values {
    my ($self, $number, $for_create) = @_;
    my $dbh = Bugzilla->dbh;
    
    Bugzilla->set_user($self->admin);

    my @selects = grep { $_->is_select } $self->all_fields;
    my %values;
    foreach my $field (@selects) {
        next if $field->is_abnormal;
        $values{$field->name} = create_legal_value($field, $number)->name;
    }

    my $group = create_group($number);
    $values{groups} = [$group->name];

    $values{'keywords'} = create_keyword($number)->name;

    foreach my $field (qw(assigned_to qa_contact reporter cc)) {
        $values{$field} = create_user("$number-$field")->login;
    }

    my $classification = Bugzilla::Classification->create(
        { name => "$number-classification-" . random() });
    $classification = $classification->name;

    my $version = "$number-version-" . random();
    my $milestone = "$number-tm-" . random(15);
    my $product = Bugzilla::Product->create({
        name => "$number-product-" . random(),
        description => 'Created by t/search.t',
        defaultmilestone => $milestone,
        classification => $classification,
        version => $version,
        allows_unconfirmed => 1,
    });
    foreach my $item ($group, $self->nobody) {
        $product->set_group_controls($item,
            { membercontrol => CONTROLMAPSHOWN,
              othercontrol => CONTROLMAPNA });
    }
    # $product->update() is called lower down.
    my $component = Bugzilla::Component->create({
        product => $product, name => "$number-component-" . random(),
        initialowner => create_user("$number-defaultowner")->login,
        initialqacontact => create_user("$number-defaultqa")->login,
        initial_cc => [create_user("$number-initcc")->login],
        description => "Component $number" });
    
    $values{'product'} = $product->name;
    $values{'component'} = $component->name;
    $values{'target_milestone'} = $milestone;
    $values{'version'} = $version;

    foreach my $field ($self->text_fields) {
        # We don't add a - after $field for the text fields, because
        # if we do, fulltext searching for short_desc pulls out
        # "short_desc" as a word and matches it in every bug.
        my $value = "$number-$field" . random();
        if ($field eq 'bug_file_loc' or $field eq 'see_also') {
            $value = "http://$value-" . random(3)
                     . "/show_bug.cgi?id=$number";
        }
        $values{$field} = $value;
    }
    $values{'tag'} = ["$number-tag-" . random()];
    
    my @date_fields = grep { $_->type == FIELD_TYPE_DATETIME } $self->all_fields;
    foreach my $field (@date_fields) {
        # We use 03 as the month because that differs from our creation_ts,
        # delta_ts, and deadline. (It's nice to have recognizable values
        # for each field when debugging.)
        my $second = $for_create ? $number : $number + 1;
        $values{$field->name} = "2037-03-0$number 12:34:0$second";
    }

    $values{alias} = "$number-alias-" . random(12);

    # Prefixing the original comment with "description" makes the
    # lesserthan and greaterthan tests behave predictably.
    my $comm_prefix = $for_create ? "description-" : '';
    $values{comment} = "$comm_prefix$number-comment-" . random()
                               . ' ' . random();

    my @flags;
    my $setter = create_user("$number-setters.login_name");
    my $requestee = create_user("$number-requestees.login_name");
    $values{set_flags} = _create_flags($number, $setter, $requestee);

    my $month = $for_create ? "12" : "02";
    $values{'deadline'} = "2037-$month-0$number";
    my $estimate_times = $for_create ? 10 : 1;
    $values{estimated_time} = $estimate_times * $number;

    $values{attachment} = _get_attach_values($number, $for_create);

    # Some things only happen on the first bug.
    if ($number == 1) {
        # We use 6 as the prefix for the extra values, because bug 6's values
        # don't otherwise get used (since bug 6 is created as a clone of
        # bug 1). This also makes sure that our greaterthan/lessthan
        # tests work properly.
        my $extra_group = create_group(6);
        $product->set_group_controls($extra_group,
            { membercontrol => CONTROLMAPSHOWN,
              othercontrol => CONTROLMAPNA });
        $values{groups} = [$values{groups}->[0], $extra_group->name];
        my $extra_keyword = create_keyword(6);
        $values{keywords} = [$values{keywords}, $extra_keyword->name];
        my $extra_cc = create_user("6-cc");
        $values{cc} = [$values{cc}, $extra_cc->login];
        my @multi_selects = grep { $_->type == FIELD_TYPE_MULTI_SELECT }
                                 $self->all_fields;
        foreach my $field (@multi_selects) {
            my $new_value = create_legal_value($field, 6);
            my $name = $field->name;
            $values{$name} = [$values{$name}, $new_value->name];
        }
        push(@{ $values{'tag'} }, "6-tag-" . random());
    }

    # On bug 5, any field that *can* be left empty, *is* left empty.
    if ($number == 5) {
        my @set_fields = grep { $_->type == FIELD_TYPE_SINGLE_SELECT }
                         $self->all_fields;
        @set_fields = map { $_->name } @set_fields;
        push(@set_fields, qw(short_desc version reporter));
        foreach my $key (keys %values) {
            delete $values{$key} unless grep { $_ eq $key } @set_fields;
        }
    }

    $product->update();

    return \%values;
}

# Flags
sub _create_flags {
    my ($number, $setter, $requestee) = @_;

    my $flagtypes = _create_flagtypes($number);

    my %flags;
    foreach my $type (qw(a b)) {
        $flags{$type} = _get_flag_values(@_, $flagtypes->{$type});
    }
    return \%flags;
}

sub _create_flagtypes {
    my ($number) = @_;
    my $dbh = Bugzilla->dbh;
    my $name = "$number-flag-" . random();
    my $desc = "FlagType $number";

    my %flagtypes; 
    foreach my $target (qw(a b)) {
         $dbh->do("INSERT INTO flagtypes
                  (name, description, target_type, is_requestable, 
                   is_requesteeble, is_multiplicable, cc_list)
                   VALUES (?,?,?,1,1,1,'')",
                   undef, $name, $desc, $target);
         my $id = $dbh->bz_last_key('flagtypes', 'id');
         $dbh->do('INSERT INTO flaginclusions (type_id) VALUES (?)',
                  undef, $id);
         my $flagtype = new Bugzilla::FlagType($id);
         $flagtypes{$target} = $flagtype;
    }
    return \%flagtypes;
}

sub _get_flag_values {
    my ($number, $setter, $requestee, $flagtype) = @_;

    my @set_flags;
    if ($number <= 2) {
        foreach my $value (qw(? - + ?)) {
            my $flag = { type_id => $flagtype->id, status => $value,
                         setter => $setter, flagtype => $flagtype };
            push(@set_flags, $flag);
        }
        $set_flags[0]->{requestee} = $requestee->login;
    }
    else {
        @set_flags = ({ type_id => $flagtype->id, status => '+',
                        setter => $setter, flagtype => $flagtype });
    }
    return \@set_flags;
}

# Attachments
sub _get_attach_values {
    my ($number, $for_create) = @_;

    my $boolean = $number == 1 ? 1 : 0;
    if ($for_create) {
        $boolean = !$boolean ? 1 : 0;
    }
    my $ispatch = $for_create ? 'ispatch' : 'is_patch';
    my $isobsolete = $for_create ? 'isobsolete' : 'is_obsolete';
    my $isprivate = $for_create ? 'isprivate' : 'is_private';
    my $mimetype = $for_create ? 'mimetype' : 'content_type';

    my %values = (
        description => "$number-attach_desc-" . random(),
        filename => "$number-filename-" . random(),
        $ispatch => $boolean,
        $isobsolete => $boolean,
        $isprivate => $boolean,
        $mimetype => "text/x-$number-" . random(),
    );
    if ($for_create) {
        $values{data} = "$number-data-" . random() . random();
    }
    return \%values;
}

################
# Bug Creation #
################

sub _create_one_bug {
    my ($self, $number) = @_;
    my $dbh = Bugzilla->dbh;
    
    # We need bug 6 to have a unique alias that is not a clone of bug 1's,
    # so we get the alias separately from the other parameters.
    my $alias = $self->bug_create_value($number, 'alias');
    my $update_alias = $self->bug_update_value($number, 'alias');
    
    # Otherwise, make bug 6 a clone of bug 1.
    my $real_number = $number;
    $number = 1 if $number == 6;
    
    my $reporter = $self->bug_create_value($number, 'reporter');
    Bugzilla->set_user(Bugzilla::User->check($reporter));
    
    # We create the bug with one set of values, and then we change it
    # to have different values.
    my %params = %{ $self->_bug_create_values->{$number} };
    $params{alias} = $alias;
    
    # There are some things in bug_create_values that shouldn't go into
    # create().
    delete @params{qw(attachment set_flags tag)};
    
    my ($status, $resolution, $see_also) = 
        delete @params{qw(bug_status resolution see_also)};
    # All the bugs are created with everconfirmed = 0.
    $params{bug_status} = 'UNCONFIRMED';
    my $bug = Bugzilla::Bug->create(\%params);