Esempio n. 1
0
 public function tearDown()
 {
     $this->fileAttribute = null;
     $this->imageObject->remove();
     $this->imageObject = null;
     eZContentClassOperations::remove($this->imageClass->id);
     $this->imageClass = null;
     parent::tearDown();
 }
Esempio n. 2
0
 public function tearDown()
 {
     $this->solrSearch->removeObject($this->object->object);
     $this->object->remove();
     $this->object = null;
     $this->solrSearch = null;
     ezpINIHelper::restoreINISettings();
     parent::tearDown();
 }
 public function tearDown()
 {
     if (self::ldapIsEnabled()) {
         $this->mainGroup->remove();
     }
     parent::tearDown();
 }
 /**
  * Regression test for issue {@see #19174 http://issues.ez.no/19174}
  */
 public function testIssue19174()
 {
     $bkpLanguages = eZContentLanguage::prioritizedLanguageCodes();
     // add a secondary language
     $locale = eZLocale::instance('fre-FR');
     $translation = eZContentLanguage::addLanguage($locale->localeCode(), $locale->internationalLanguageName());
     // create related objects
     $relatedObjectsIds = array($this->createObjectForRelation(), $this->createObjectForRelation(), $this->createObjectForRelation(), $this->createObjectForRelation());
     $xmlTextEn = "<embed href=\"ezobject://{$relatedObjectsIds[0]}\" /><link href=\"ezobject://{$relatedObjectsIds[1]}\">link</link>";
     $xmlTextFr = "<embed href=\"ezobject://{$relatedObjectsIds[2]}\" /><link href=\"ezobject://{$relatedObjectsIds[3]}\">link</link>";
     // Create an article in eng-GB, and embed related object one in the intro
     $article = new ezpObject('article', 2, 14, 1, 'eng-GB');
     $article->title = __METHOD__ . ' eng-GB';
     $article->intro = $xmlTextEn;
     $articleId = $article->publish();
     // Workaround as setting folder->name directly doesn't produce the expected result
     $article->addTranslation('fre-FR', array('title' => __METHOD__ . ' fre-FR', 'intro' => $xmlTextFr));
     $relatedObjects = eZContentObject::fetch($articleId)->relatedObjects(false, false, 0, false, array('AllRelations' => eZContentObject::RELATION_LINK | eZContentObject::RELATION_EMBED));
     self::assertEquals(4, count($relatedObjects));
     $expectedRelations = array_flip($relatedObjectsIds);
     foreach ($relatedObjects as $relatedObject) {
         if (isset($expectedRelations[$relatedObject->ID])) {
             unset($expectedRelations[$relatedObject->ID]);
         }
     }
     self::assertEquals(0, count($expectedRelations));
     $article->remove();
     $translation->removeThis();
     eZContentLanguage::setPrioritizedLanguages($bkpLanguages);
 }
 /**
  * @group issue18249
  */
 public function testIssue18249()
 {
     // setup a class C1 with objectrelationlist and pattern name
     $classIdentifier = strtolower(__FUNCTION__);
     $class1 = new ezpClass(__FUNCTION__, $classIdentifier, '<test_name><test_relation>');
     $class1->add('Test name', 'test_name', 'ezstring');
     $class1->add('Test Relation', 'test_relation', 'ezobjectrelationlist');
     $class1->store();
     $o1 = new ezpObject('article', 2, 14, 1, 'eng-GB');
     $o1->title = 'Test_ENG';
     $o1->publish();
     $o1->addTranslation('xxx-XX', array('title' => 'Test_XXX'));
     $o2 = new ezpObject($classIdentifier, 2, 14, 1, 'xxx-XX');
     $o2->test_name = 'name_';
     $o2->test_relation = array($o1->attribute('id'));
     $o2->publish();
     // test O2's name
     $this->assertEquals('name_Test_XXX', $o2->name);
     $o1->remove();
     $o2->remove();
 }
Esempio n. 6
0
 /**
  * @see http://issues.ez.no/19062
  * @group issue19062
  * @covers eZURLAliasML::translate
  */
 public function testTranslateWildcardNopUri()
 {
     $folder = new ezpObject('folder', 2);
     $folder->name = 'foo';
     $folder->publish();
     // By creating following URL alias, "test/single-page" will be registered as a NOP URI segment
     $uriFirstSegment = 'test19062';
     $uriWildcard = "{$uriFirstSegment}/single-page";
     $res = eZURLAliasML::storePath("{$uriWildcard}/article.html", "eznode:{$folder->mainNode->node_id}", $this->englishLanguage, 0, true);
     $wildcard = eZURLWildcardTest::createWildcard($uriWildcard, 'foo', eZURLWildcard::TYPE_FORWARD);
     // Translating the wildcard URL should return false in order to be then translated by eZURLWildcard in index.php
     self::assertFalse(eZURLAliasML::translate($uriWildcard));
     // Here no wildcard and test19062 should be a nop segment (points to nothing.
     // Default behaviour is to return true and redirect to root ("/")
     self::assertTrue(eZURLAliasML::translate($uriFirstSegment));
     $folder->remove();
     $wildcard->remove();
 }
 /**
  * Test for issue #14370: Inserting non break space doesn't work
  *
  * @note Test depends on template output!!
  * @link http://issues.ez.no/14370
  */
 public function testNonBreakSpace()
 {
     $xmlData = '<paragraph>esp&nbsp;ace</paragraph>';
     // Step 1: Create folder
     $folder = new ezpObject("folder", 2);
     $folder->name = "Non breaking space Test";
     $folder->short_description = $xmlData;
     $folder->publish();
     $xhtml = $folder->short_description->attribute('output')->attribute('output_text');
     $folder->remove();
     self::assertEquals('<p>esp&nbsp;ace</p>', $xhtml);
 }
    /**
     * Regression test for issue {@see #17632 http://issues.ez.no/17632}
     *
     * In a multi language environment, a node fetched with a language other than the prioritized one(s) will return the
     * URL alias in the prioritized language
     */
    public function testIssue17632()
    {
        $bkpLanguages = eZContentLanguage::prioritizedLanguageCodes();

        $strNameEngGB = __FUNCTION__ . " eng-GB";
        $strNameFreFR = __FUNCTION__ . " fre-FR";

        // add a secondary language
        $locale = eZLocale::instance( 'fre-FR' );
        $translation = eZContentLanguage::addLanguage( $locale->localeCode(), $locale->internationalLanguageName() );

        // set the prioritize language list to contain english
        // ezpINIHelper::setINISetting( 'site.ini', 'RegionalSettings', 'SiteLanguageList', array( 'fre-FR' ) );
        eZContentLanguage::setPrioritizedLanguages( array( 'fre-FR' ) );

        // Create an object with data in fre-FR and eng-GB
        $folder = new ezpObject( 'folder', 2, 14, 1, 'eng-GB' );
        $folder->publish();

        // Workaround as setting folder->name directly doesn't produce the expected result
        $folder->addTranslation( 'eng-GB', array( 'name' => $strNameEngGB ) );
        $folder->addTranslation( 'fre-FR', array( 'name' => $strNameFreFR ) );

        $nodeId = $folder->main_node_id;

        // fetch the node with no default parameters. Should return the french URL Alias
        $node = eZContentObjectTreeNode::fetch( $nodeId );
        self::assertEquals( 'testIssue17632-fre-FR' , $node->attribute( 'url_alias' ) );

        // fetch the node in english. Should return the english URL Alias
        $node = eZContentObjectTreeNode::fetch( $nodeId, 'eng-GB' );
        self::assertEquals( 'testIssue17632-eng-GB' , $node->attribute( 'url_alias' ) );

        $folder->remove();
        $translation->removeThis();
        ezpINIHelper::restoreINISettings();
        eZContentLanguage::setPrioritizedLanguages( $bkpLanguages );
    }