/**
  * Tests 'show' action.
  */
 public function testShowAction()
 {
     $this->createsModels = true;
     $licence = new Opus_Licence();
     $licence->setActive(true);
     $licence->setNameLong('TestNameLong');
     $licence->setLanguage('deu');
     $licence->setLinkLicence('www.example.org/licence');
     $licence->setLinkLogo('www.example.org/licence/logo.png');
     $licence->setLinkSign('TestLinkSign');
     // wird nicht angezeigt (soll später entfernt werden - OPUSVIER-1492)
     $licence->setDescText('TestDescText');
     $licence->setDescMarkup('TestDescMarkup');
     $licence->setCommentInternal('TestCommentInternal');
     $licence->setMimeType('text/plain');
     $licence->setPodAllowed(false);
     $licence->setSortOrder(100);
     $licenceId = $licence->store();
     $this->dispatch('/admin/licence/show/id/' . $licenceId);
     $licence = new Opus_Licence($licenceId);
     $licence->delete();
     $this->assertResponseCode(200);
     $this->assertController('licence');
     $this->assertAction('show');
     $this->assertQueryContentRegex('div#Active', '/Yes|Ja/');
     $this->assertQueryContentContains('div#NameLong', 'TestNameLong');
     $this->assertQueryContentRegex('div#Language', '/German|Deutsch/');
     $this->assertQueryContentContains('div#LinkLicence', 'www.example.org/licence');
     $this->assertQueryContentContains('div#LinkLogo', 'www.example.org/licence/logo.png');
     $this->assertQueryContentContains('div#DescText', 'TestDescText');
     $this->assertQueryContentContains('div#DescMarkup', 'TestDescMarkup');
     $this->assertQueryContentContains('div#CommentInternal', 'TestCommentInternal');
     $this->assertQueryContentContains('div#MimeType', 'text/plain');
     $this->assertQueryContentRegex('div#PodAllowed', '/No|Nein/');
     $this->assertQueryContentContains('div#SortOrder', '100');
     // wird nicht angezeigt - OPUSVIER-1492
     $this->assertQueryCount('div#LinkSign', 0);
     $this->assertNotQueryContentContains('div#content', 'TestLinkSign');
     // TODO $this->validateXHTML();
 }
示例#2
0
 /**
  * transfers any OPUS3-conform classification System into an array
  *
  * @param DOMDocument $data XML-Document to be imported
  * @return array List of documents that have been imported
  */
 protected function transferOpus3Licence($data)
 {
     //$classification = array();
     $doclist = $data->getElementsByTagName('row');
     $licenses = array();
     foreach ($doclist as $document) {
         $lic = new Opus_Licence();
         $shortname = "";
         foreach ($document->getElementsByTagName('field') as $field) {
             if ($field->nodeValue === '') {
                 continue;
             }
             if ($field->getAttribute('name') === 'active') {
                 $lic->setActive($field->nodeValue);
             }
             if ($field->getAttribute('name') === 'comment') {
                 $lic->setCommentInternal($field->nodeValue);
             }
             if ($field->getAttribute('name') === 'desc_html') {
                 $lic->setDescMarkup($field->nodeValue);
             }
             if ($field->getAttribute('name') === 'desc_text') {
                 $lic->setDescText(html_entity_decode($field->nodeValue, ENT_COMPAT, 'UTF-8'));
             }
             if ($field->getAttribute('name') === 'language') {
                 $lic->setLanguage($this->mapLanguage($field->nodeValue));
             }
             if ($field->getAttribute('name') === 'link') {
                 $lic->setLinkLicence($field->nodeValue);
             }
             if ($field->getAttribute('name') === 'logo') {
                 $lic->setLinkLogo($field->nodeValue);
             }
             if ($field->getAttribute('name') === 'link_tosign') {
                 $lic->setLinkSign($field->nodeValue);
             }
             if ($field->getAttribute('name') === 'mime_type') {
                 $lic->setMimeType($field->nodeValue);
             }
             if ($field->getAttribute('name') === 'longname') {
                 $lic->setNameLong(html_entity_decode($field->nodeValue, ENT_COMPAT, 'UTF-8'));
             }
             if ($field->getAttribute('name') === 'pod_allowed') {
                 $lic->setPodAllowed($field->nodeValue);
             }
             //if ($field->getAttribute('name') === 'sort') $lic->setSortOrder($field->nodeValue);
             if ($field->getAttribute('name') === 'shortname') {
                 $shortname = $field->nodeValue;
             }
         }
         $this->checkMandatoryFields($lic, $shortname);
         $this->maxSortOrder++;
         $lic->setSortOrder($this->maxSortOrder);
         $licenses[$shortname] = $lic;
     }
     return $licenses;
 }