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


PHP ezpObject::currentVersion方法代碼示例

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


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

示例1: testFetchChildListByVersionStatus

 /**
  * test fetchChildListByVersionStatus
  */
 public function testFetchChildListByVersionStatus()
 {
     //create object
     $top = new ezpObject('article', 2);
     $top->name = 'TOP ARTICLE';
     $top->publish();
     $child = new ezpObject('article', $top->mainNode->node_id);
     $child->name = 'THIS IS AN ARTICLE';
     $child->publish();
     $child2 = new ezpObject('article', $top->mainNode->node_id);
     $child2->name = 'THIS IS AN ARTICLE2';
     $child2->publish();
     $pendingChild = new ezpObject('article', $top->mainNode->node_id);
     $pendingChild->name = 'THIS IS A PENDING ARTICLE';
     $pendingChild->publish();
     $version = $pendingChild->currentVersion();
     $version->setAttribute('status', eZContentObjectVersion::STATUS_PENDING);
     $version->store();
     $idList = array($top->mainNode->node_id);
     $arrayResult = eZNodeAssignment::fetchChildListByVersionStatus($idList, eZContentObjectVersion::STATUS_PENDING, false);
     $this->assertEquals($pendingChild->id, $arrayResult[0]['contentobject_id']);
     $arrayResult = eZNodeAssignment::fetchChildListByVersionStatus($idList, eZContentObjectVersion::STATUS_PUBLISHED, true);
     $this->assertEquals($child->id, $arrayResult[0]->attribute('contentobject_id'));
     $countResult = eZNodeAssignment::fetchChildCountByVersionStatus($idList, eZContentObjectVersion::STATUS_PENDING);
     $this->assertEquals(1, $countResult);
     $countResult = eZNodeAssignment::fetchChildCountByVersionStatus($idList, eZContentObjectVersion::STATUS_PUBLISHED);
     $this->assertEquals(2, $countResult);
 }
開發者ID:runelangseid,項目名稱:ezpublish,代碼行數:31,代碼來源:eznodeassignment_test.php

示例2: testIssue16949

    /**
     * Regression test for issue #16949
     * 1) Test there is no pending object in sub objects
     * 2) Test there is one pending object in sub objects
     */
    public function testIssue16949()
    {
        //create object
        $top = new ezpObject( 'article', 2 );
        $top->title = 'TOP ARTICLE';
        $top->publish();
        $child = new ezpObject( 'article', $top->mainNode->node_id );
        $child->title = 'THIS IS AN ARTICLE';
        $child->publish();

        $adminUser = eZUser::fetchByName( 'admin' );
        $adminUserID = $adminUser->attribute( 'contentobject_id' );
        $currentUser = eZUser::currentUser();
        $currentUserID = eZUser::currentUserID();
        eZUser::setCurrentlyLoggedInUser( $adminUser, $adminUserID );

        $result = eZContentObjectTreeNode::subtreeRemovalInformation( array( $top->mainNode->node_id ) );
        $this->assertFalse( $result['has_pending_object'] );
        $workflowArticle = new ezpObject( 'article', $top->mainNode->node_id );
        $workflowArticle->title = 'THIS IS AN ARTICLE WITH WORKFLOW';
        $workflowArticle->publish();
        $version = $workflowArticle->currentVersion();
        $version->setAttribute( 'status', eZContentObjectVersion::STATUS_PENDING );
        $version->store();
        $result = eZContentObjectTreeNode::subtreeRemovalInformation( array( $top->mainNode->node_id ) );
        $this->assertTrue( $result['has_pending_object'] );

        eZUser::setCurrentlyLoggedInUser( $currentUser, $currentUserID );
    }
開發者ID:nottavi,項目名稱:ezpublish,代碼行數:34,代碼來源:ezcontentobjecttreenode_regression.php


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