protected function addClassToSubpackage($classname, $element)
    {
        $subpackageName = PHPUnitUtil::getSubpackageName($classname);

        $subpackage = $this->getSubpackageElement($subpackageName);

        if ($subpackage === null) {
            $subpackage = $this->doc->createElement('subpackage');
            $subpackage->setAttribute('name', $subpackageName);
            $this->doc->documentElement->appendChild($subpackage);
        }

        $subpackage->appendChild($element);
    }