当前位置: 首页>>代码示例>>PHP>>正文


PHP ezpObject::publish方法代码示例

本文整理汇总了PHP中ezpObject::publish方法的典型用法代码示例。如果您正苦于以下问题:PHP ezpObject::publish方法的具体用法?PHP ezpObject::publish怎么用?PHP ezpObject::publish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ezpObject的用法示例。


在下文中一共展示了ezpObject::publish方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     ezpINIHelper::setINISetting('site.ini', 'SearchSettings', 'AllowEmptySearch', 'enabled');
     ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'SiteLanguageList', array('eng-GB'));
     $this->findINI = eZINI::instance('ezfind.ini');
     $this->findINI->loadCache(true);
     $this->solrSearch = new eZSolr();
     $this->object = new ezpObject('folder', 2);
     $this->object->name = 'foo';
     $this->object->publish();
     $this->object->addNode(43);
     // Add a location under Media node
     $this->solrSearch->addObject($this->object->object);
 }
开发者ID:netbliss,项目名称:ezfind,代码行数:15,代码来源:ezsolr_regression.php

示例2: testDisplayVariableWithObject

    /**
     * Tests that the output process works with objects.
     *
     * There should be no crash from casting errors.
     * @group templateOperators
     * @group attributeOperator
     */
    public function testDisplayVariableWithObject()
    {
        $db = eZDB::instance();

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

        $nodeId = $folder->mainNode->node_id;

        $node = eZContentObjectTreeNode::fetch( $nodeId );
        $attrOp = new eZTemplateAttributeOperator();
        $outputTxt = '';
        $formatterMock = $this->getMock( 'ezpAttributeOperatorFormatterInterface' );
        $formatterMock->expects( $this->any() )
                      ->method( 'line' )
                      ->will( $this->returnValue( __METHOD__ ) );

        try
        {
            $attrOp->displayVariable( $node, $formatterMock, true, 2, 0, $outputTxt );
        }
        catch ( PHPUnit_Framework_Error $e )
        {
            self::fail( "eZTemplateAttributeOperator raises an error when working with objects." );
        }

        self::assertNotNull( $outputTxt, "Output text is empty." );
        // this is an approxmiate test. The output shoudl contain the name of the object it has been generated correctly.
        self::assertContains( __METHOD__, $outputTxt, "There is something wrong with the output of the attribute operator. Object name not found." );
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:39,代码来源:eztemplateattributeoperator_test.php

示例3: testIssue16078

 /**
  * Regression test for issue #16078
  *
  * @link http://issues.ez.no/16078
  */
 public function testIssue16078()
 {
     $classID = 5;
     // image class, can remain hardcoded, I guess
     $baseImagePath = dirname(__FILE__) . '/ezimagefile_regression_issue16078.png';
     $parts = pathinfo($baseImagePath);
     $imagePattern = $parts['dirname'] . DIRECTORY_SEPARATOR . $parts['filename'] . '_%s_%d.' . $parts['extension'];
     $toDelete = array();
     // Create version 1
     $imagePath = sprintf($imagePattern, md5(1), 1);
     copy($baseImagePath, $imagePath);
     $toDelete[] = $imagePath;
     $image = new ezpObject('image', 43);
     $image->name = __FUNCTION__;
     $image->image = $imagePath;
     $image->publish();
     $image->refresh();
     $publishedDataMap = $image->object->dataMap();
     $files = eZImageFile::fetchForContentObjectAttribute($publishedDataMap['image']->attribute('id'));
     $publishedImagePath = $files[0];
     // Create a new image file
     $imagePath = sprintf($imagePattern, md5(2), 2);
     copy($baseImagePath, $imagePath);
     $toDelete[] = $imagePath;
     // Create version 2 in another language, and remove it
     $languageCode = 'nor-NO';
     $version = self::addTranslationDontPublish($image, $languageCode);
     $version->removeThis();
     // Check that the original file still exists
     $this->assertTrue(file_exists($publishedImagePath), 'The image file from version 1 should still exist when version 2 is removed');
     array_map('unlink', $toDelete);
     $image->purge();
 }
开发者ID:,项目名称:,代码行数:38,代码来源:

示例4: testApprovalFatalErrorWhenMoving

 /**
  * Test regression for issue #13952: Workflow cronjob gives fatal error if
  * node is moved to different location before approval.
  *
  * Test Outline
  * ------------
  * 1. Create a folder
  * 2. Approve folder
  * 3. Create child of folder
  * 4. Approve child
  * 5. Create a new version and re-publish the child
  * 6. Move child to root
  * 7. Approve child
  * 8. Run approval cronjob
  *
  * @result: Fatal error: Call to a member function attribute() on a non-object in
  *          /www/trunk/kernel/content/ezcontentoperationcollection.php on line 313
  * @expected: No fatal error
  * @link http://issues.ez.no/13952
  */
 public function testApprovalFatalErrorWhenMoving()
 {
     $anonymousObjectID = eZUser::fetchByName('anonymous')->attribute('contentobject_id');
     // STEP 1: Create a folder
     $folder = new ezpObject("folder", 2, $anonymousObjectID);
     $folder->name = "Parent folder (needs approval)";
     $folder->publish();
     // STEP 2: Approve folder
     $collaborationItem = eZCollaborationItem::fetch(1);
     $this->approveCollaborationItem($collaborationItem);
     $this->runWorkflow();
     // STEP 3: Create child of folder
     $child = new ezpObject("folder", $folder->mainNode->node_id, $anonymousObjectID);
     $child->name = "Child folder (needs approval)";
     $child->publish();
     // STEP 4: Approve child
     $collaborationItem = eZCollaborationItem::fetch(2);
     $this->approveCollaborationItem($collaborationItem);
     $this->runWorkflow();
     // STEP 5: Re-publish child
     $newVersion = $child->createNewVersion();
     ezpObject::publishContentObject($child->object, $newVersion);
     // STEP 6: Move child to root
     $child->mainNode->move(2);
     // STEP 7: Approve child again
     $collaborationItem = eZCollaborationItem::fetch(3);
     $this->approveCollaborationItem($collaborationItem);
     // STEP 8: Run approval cronjob
     $this->runWorkflow();
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:50,代码来源:ezapprovetype_regression.php

示例5: 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

示例6: testFetchUserList

    /**
     * Unit test for eZSubtreeNotificationRule::fetchUserList()
     */
    public function testFetchUserList()
    {
        // Add a notification rule for admin on root
        $adminUserID = eZUser::fetchByName( 'admin' )->attribute( 'contentobject_id' );
        $rule = new eZSubtreeNotificationRule( array(
            'user_id' => $adminUserID,
            'use_digest' => 0,
            'node_id' => 2 ) );
        $rule->store();

        // Create a content object below node #2
        $article = new ezpObject( 'article', 2 );
        $article->title = __FUNCTION__;
        $article->publish();
        $articleContentObject = $article->object;

        $list = eZSubtreeNotificationRule::fetchUserList( array( 2, 43 ), $articleContentObject );
        $this->assertInternalType( 'array', $list,
            "Return value should have been an array" );
        $this->assertEquals( 1, count( $list ),
            "Return value should have one item" );
        $this->assertInternalType( 'array', $list[0] );
        $this->assertArrayHasKey( 'user_id', $list[0] );
        $this->assertArrayHasKey( 'use_digest', $list[0] );
        $this->assertArrayHasKey( 'address', $list[0] );
        $this->assertEquals( 14, $list[0]['user_id'] );
        $this->assertEquals( 0, $list[0]['use_digest'] );
        $this->assertEquals( 'nospam@ez.no', $list[0]['address'] );
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:32,代码来源:ezsubtreenotificationrule_test.php

示例7: testIssue14983

 /**
  * Regression test for issue #14983
  *
  * @link http://issues.ez.no/14983
  **/
 public function testIssue14983()
 {
     $className = 'eZImageType test class';
     $classIdentifier = 'ezimagetype_test_class';
     $attributeName = 'Image';
     $attributeIdentifier = 'image';
     $attributeType = 'ezimage';
     $filePath = 'tests/tests/kernel/datatypes/ezimage/ezimagetype_regression_issue14983.png';
     $class = new ezpClass($className, $classIdentifier, $className);
     $classAttribute = $class->add($attributeName, $attributeIdentifier, $attributeType);
     $class->store();
     $object = new ezpObject($classIdentifier, 2);
     $object->name = __FUNCTION__;
     $dataMap = $object->object->dataMap();
     $fileAttribute = $dataMap[$attributeIdentifier];
     $dataType = new eZImageType();
     $dataType->fromString($fileAttribute, $filePath);
     $fileAttribute->store();
     $object->publish();
     $object->refresh();
     $contentObjectAttributeID = $fileAttribute->attribute("id");
     $files = eZImageFile::fetchForContentObjectAttribute($contentObjectAttributeID);
     $file = $files[0];
     // Read stored path, move to trash, and read stored path again
     $this->assertNotEquals($file, null);
     $oldFile = $file;
     $object->object->removeThis();
     $object->refresh();
     $files = eZImageFile::fetchForContentObjectAttribute($contentObjectAttributeID);
     $file = $files[0];
     $this->assertNotEquals($oldFile, $file, 'The stored file should be renamed when trashed');
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:37,代码来源:ezimagetype_regression.php

示例8: testIssue18249

    /**
     * @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 );
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:28,代码来源:ezobjectrelationlist_regression.php

示例9: testUpdateAndPublishObject

 public function testUpdateAndPublishObject()
 {
     // create content object first
     $object = new ezpObject("folder", 2);
     $object->title = __FUNCTION__ . '::' . __LINE__ . '::' . time();
     $object->publish();
     $contentObjectID = $object->attribute('id');
     if ($object instanceof eZContentObject) {
         $now = date('Y/m/d H:i:s', time());
         $sectionID = 3;
         $remoteID = md5($now);
         $attributeList = array('name' => 'name ' . $now, 'short_name' => 'short_name ' . $now, 'short_description' => 'short_description' . $now, 'description' => 'description' . $now, 'show_children' => false);
         $params = array();
         $params['attributes'] = $attributeList;
         $params['remote_id'] = $remoteID;
         $params['section_id'] = $sectionID;
         $result = eZContentFunctions::updateAndPublishObject($object, $params);
         $this->assertTrue($result);
         $object = eZContentObject::fetch($contentObjectID);
         $this->assertEquals($object->attribute('section_id'), $sectionID);
         $this->assertEquals($object->attribute('remote_id'), $remoteID);
         $dataMap = $object->dataMap();
         $this->assertEquals($attributeList['name'], $dataMap['name']->content());
         $this->assertEquals($attributeList['short_name'], $dataMap['short_name']->content());
         $this->assertEquals($attributeList['short_description'], $dataMap['short_description']->content());
         $this->assertEquals($attributeList['description'], $dataMap['description']->content());
         $this->assertEquals($attributeList['show_children'], (bool) $dataMap['show_children']->content());
     }
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:29,代码来源:ezcontentfunctions_test.php

示例10: createImage

 /**
  * @param string $name
  * @return eZContentObject
  */
 protected function createImage($name)
 {
     $imageObject = new ezpObject(self::CLASS_IDENTIFIER, 2);
     $imageObject->name = $name;
     $imageObject->image = self::IMAGE_FILE_PATH;
     $imageObject->publish();
     return $this->forceFetchContentObject($imageObject->attribute('id'));
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:12,代码来源:ezcachetest.php

示例11: setUp

 public function setUp()
 {
     parent::setUp();
     $classIdentifier = "ezimagetype_test_class";
     $this->imageClass = new ezpClass("eZImageType test class", $classIdentifier, "eZImageType test class");
     $this->imageClass->add("Image", "image", "ezimage");
     $this->imageClass->store();
     $this->imageObject = new ezpObject($classIdentifier, 2);
     $this->imageObject->name = __METHOD__;
     $dataMap = $this->imageObject->object->dataMap();
     $this->fileAttribute = $dataMap["image"];
     $dataType = new eZImageType();
     $dataType->fromString($this->fileAttribute, self::IMAGE_FILE_PATH);
     $this->fileAttribute->store();
     $this->imageObject->publish();
     $this->imageObject->refresh();
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:17,代码来源:ezimagetype_regression.php

示例12: createObjectForRelation

 private function createObjectForRelation($title = false)
 {
     if (!$title) {
         $title = uniqid(__METHOD__);
     }
     $relatedObject = new ezpObject('article', 2, 14, 1, 'eng-GB');
     $relatedObject->title = $title;
     return $relatedObject->publish();
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:9,代码来源:ezxmltexttype_regression.php

示例13: createEZPArticle

 /**
  * Creates an article in eZ Publish in the folder $folderId,
  * with title $articleTitle and summary $articleIntro and returns its ID.
  *
  * @param int $folderId
  * @param string $articleName
  * @param string $articleIntro
  * @return int The ID of the article created
  */
 public function createEZPArticle($folderId, $articleTitle, $articleIntro)
 {
     $object = new ezpObject('article', $folderId);
     $object->title = $articleTitle;
     $object->intro = $articleIntro;
     $object->publish();
     $objectId = (int) $object->attribute('id');
     return $objectId;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:18,代码来源:ezrss_export_test.php

示例14: testRemoveAssignments

    /**
     * Test to verify that eznode_assignment entres get removed.
     *
     * @link http://issues.ez.no/15478
     */
    public function testRemoveAssignments()
    {
        $db = eZDB::instance();

        $testSet = array();

        $folder = new ezpObject( "folder", 2 );
        $folder->name = __FUNCTION__;
        $folder->publish();
        $testSet[] = $folder;

        $childOne = new ezpObject( "folder", $folder->mainNode->node_id );
        $childOne->name = "ChildOne";
        $childOne->publish();
        $testSet[] = $childOne;

        $childTwo = new ezpObject( "folder", $folder->mainNode->node_id );
        $childTwo->name = "ChildTwo";
        $childTwo->publish();
        $testSet[] = $childTwo;

        $subChildOne = new ezpObject( 'article', $childOne->mainNode->node_id );
        $subChildOne->title = "SubChild";
        $subChildOne->publish();
        $testSet[] = $subChildOne;

        $subChildTwo = new ezpObject( 'article', $childOne->mainNode->node_id );
        $subChildTwo->title = "SubChildOther";
        $subChildTwo->publish();
        $testSet[] = $subChildTwo;

        $subChildThree = new ezpObject( 'article', $childOne->mainNode->node_id );
        $subChildThree->title = "SubChildThird";
        $subChildThree->publish();
        $testSet[] = $subChildThree;

        // Let's add another placement here
        $newPlacementSubChildOne = $subChildOne->addNode( $childTwo->mainNode->node_id );
        $testSet[] = $newPlacementSubChildOne;

        // $this->debugBasicNodeInfo( $testSet );

        $coId = $newPlacementSubChildOne->attribute( 'contentobject_id' );

        eZContentOperationCollection::removeAssignment( $childTwo->mainNode->node_id, $childTwo->id, array( $newPlacementSubChildOne ), false );

        $checkSql = "SELECT * FROM eznode_assignment WHERE contentobject_id = {$coId}";
        $result = $db->arrayQuery( $checkSql );

        // After removing one of the assignments, the number of node
        // assignments for the content object should be only one.
        $numberOfAssignments = count( $result );

        self::assertEquals( 1, $numberOfAssignments, "The number of node assignments are not correct, eznode_assignment table not cleaned up correctly." );
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:60,代码来源:ezcontentoperationcollection_regression.php

示例15: testIssue15155

 /**
  * Regression test for issue #15155
  *
  * @link http://issues.ez.no/15155
  */
 public function testIssue15155()
 {
     // figure out the max versions for images
     $contentINI = eZINI::instance('content.ini');
     $versionlimit = $contentINI->variable('VersionManagement', 'DefaultVersionHistoryLimit');
     $limitList = eZContentClass::classIDByIdentifier($contentINI->variable('VersionManagement', 'VersionHistoryClass'));
     $classID = 5;
     // image class, can remain hardcoded, I guess
     foreach ($limitList as $key => $value) {
         if ($classID == $key) {
             $versionlimit = $value;
         }
     }
     if ($versionlimit < 2) {
         $versionlimit = 2;
     }
     $baseImagePath = dirname(__FILE__) . '/ezimagealiashandler_regression_issue15155.png';
     $parts = pathinfo($baseImagePath);
     $imagePattern = $parts['dirname'] . DIRECTORY_SEPARATOR . $parts['filename'] . '_%s_%d.' . $parts['extension'];
     $toDelete = array();
     // Create version 1
     $imagePath = sprintf($imagePattern, md5(1), 1);
     copy($baseImagePath, $imagePath);
     $toDelete[] = $imagePath;
     $image = new ezpObject('image', 43);
     $image->name = __FUNCTION__;
     $image->image = $imagePath;
     $image->publish();
     $image->refresh();
     $contentObjectID = $image->object->attribute('id');
     $dataMap = eZContentObject::fetch($contentObjectID)->dataMap();
     $originalAliases[1] = $image->image->imageAlias('original');
     for ($i = 2; $i <= 20; $i++) {
         // Create a new image file
         $imagePath = sprintf($imagePattern, md5($i), $i);
         copy($baseImagePath, $imagePath);
         $toDelete[] = $imagePath;
         $newVersion = $image->createNewVersion();
         $dataMap = $newVersion->dataMap();
         $dataMap['image']->fromString($imagePath);
         ezpObject::publishContentObject($image->object, $newVersion);
         $image->refresh();
         $originalAliases[$i] = $image->image->imageAlias('original');
         if ($i > $versionlimit) {
             $removeVersion = $i - $versionlimit;
             $aliasPath = $originalAliases[$removeVersion]['url'];
             $this->assertFalse(file_exists($aliasPath), "Alias {$aliasPath} for version {$removeVersion} should have been removed");
         }
     }
     array_map('unlink', $toDelete);
     $image->purge();
 }
开发者ID:schwabokaner,项目名称:ezpublish-legacy,代码行数:57,代码来源:ezimagealiashandler_regression.php


注:本文中的ezpObject::publish方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。