當前位置: 首頁>>代碼示例>>PHP>>正文


PHP eZContentLanguage::attribute方法代碼示例

本文整理匯總了PHP中eZContentLanguage::attribute方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZContentLanguage::attribute方法的具體用法?PHP eZContentLanguage::attribute怎麽用?PHP eZContentLanguage::attribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eZContentLanguage的用法示例。


在下文中一共展示了eZContentLanguage::attribute方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testURLAliasCombinedTranslationEntry

    /**
     * Test that the language mask of an url alias element is downgraded
     * when a translation is removed.
     *
     * Test Outline
     * ------------
     * 1. Add a Folder.
     * 2. Add a ChildNode of folder.
     * 3. Add a translation (nor-NO) to ChildNode (lang_mask should be 6 now).
     * 4. Change the translation (nor-NO) of ChildNode to something else
     * 5. PROBLEM: The row with both translation are retired, and original
     *             translation is lost. (Converted into a history element with incorrect
     *             language mask)
     * 6. VERIFY: That lang_mask has been downgraded for the orignal
     *            entry, and that a new entry for the new translation has been made.
     *
     * @link http://issues.ez.no/14787
     */
    function testURLAliasCombinedTranslationEntry()
    {
        $db = eZDB::instance();

        // STEP 1: Add test folder
        $folder = new ezpObject( "folder", 2 );
        $folder->name = __FUNCTION__;
        $folder->publish();

        // STEP 2: Add child below folder
        $child = new ezpObject( "article", $folder->mainNode->node_id );
        $child->title = "Child";
        $child->publish();

        // STEP 3: Add translation to child with the same name
        $translationAttributes = array( "title" => "Child" );
        $child->addTranslation( "nor-NO", $translationAttributes );

        // STEP 4: Update the translation
        $child->refresh();
        $newVersion = $child->createNewVersion( false, true, 'nor-NO' );
        $norDataMap = $child->fetchDataMap( $newVersion->attribute( 'version' ), "nor-NO" );
        $norDataMap['title']->setAttribute( 'data_text', 'NorChildChanged' );
        $norDataMap['title']->store();
        ezpObject::publishContentObject( $child->object, $newVersion );

        // STEP 5: Issue arose here.

        // STEP 6: Verify that lang_mask has been downgraded for the orignal
        // entry, and that a new entry for the new translation has been made,
        // also make sure that the pre-existing entry has not been set as a
        // history element.

        $query = self::buildSql( array( $child->mainNode->node_id ) );
        $result = $db->arrayQuery( $query );

        $childRawData = self::urlEntryForName( 'Child', $result );

        // Assert that language has been set back to main translation only
        self::assertEquals(
            $this->englishLanguage->attribute( 'id' ),
            (int)$childRawData['lang_mask'], "Pre-existing URL entry did not have its language mask updated to remove changed translation."
        );

        // Assert that the already existing url entry wasn't marked as a hitory element.
        self::assertEquals( 1, (int)$childRawData['is_original'], "Pre-existing URL entry has incorrectly been marked as a history entry, while it still represents valid URLs." );

        // Assert that new entry is created for changed translation, sharing same id
        $newTranslatedChildData = self::urlEntryForName( 'NorChildChanged', $result );
        self::assertEquals( (int)$childRawData['id'], (int)$newTranslatedChildData['id'], "Newly created translation of existing action should have same id." );

        self::assertEquals( $this->norskLanguage->attribute( 'id' ), (int)$newTranslatedChildData['lang_mask'] );
    }
開發者ID:robinmuilwijk,項目名稱:ezpublish,代碼行數:71,代碼來源:urlaliasml_regression.php


注:本文中的eZContentLanguage::attribute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。