/**
  * Setup:
  * - creates a new content class with the tested datatype
  * - instanciates a content object of that class with the default dataset
  */
 public function setUp()
 {
     // create a content class with this datatype
     // @todo Add naming pattern handling
     parent::setUp();
     $contentClassName = "Datatype {$this->datatype} test";
     $contentClassIdentifier = "datatype_{$this->datatype}_test";
     $this->attributeIdentifier = "{$this->datatype}_test";
     $this->class = new ezpClass($contentClassName, $contentClassIdentifier, '<name>');
     $this->class->add('Title', 'title', 'ezstring');
     $this->class->add("Test {$this->datatype}", $this->attributeIdentifier, $this->datatype);
     $this->class->store();
 }
    /**
     * @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 );
    }
 /**
  * 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');
 }
 public function setUp()
 {
     parent::setUp();
     $imageClass = new ezpClass(self::CLASS_IDENTIFIER, self::CLASS_IDENTIFIER, "<name>");
     $imageClass->add("Name", "name", "ezstring");
     $imageClass->add("Image", "image", "ezimage");
     $imageClass->store();
 }
Esempio n. 5
0
 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();
 }
    /**
     * Regression test for issue #14983
     *
     * @link http://issues.ez.no/14983
     */
    public function testIssue14983()
    {
        $className = 'eZBinaryFileType test class';
        $classIdentifier = 'ezbinaryfiletype_test_class';
        $attributeName = 'File';
        $attributeIdentifier = 'file';
        $attributeType = 'ezbinaryfile';
        $filePath = 'tests/tests/kernel/datatypes/ezbinaryfile/ezbinaryfiletype_regression_issue14983.txt';

        $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 eZBinaryFileType();
                $dataType->fromString( $fileAttribute, $filePath );
            }
            $fileAttribute->store();
        }
        $object->publish();
        $object->refresh();

        $contentObjectAttributeID = $fileAttribute->attribute( "id" );
        $files = eZBinaryFile::fetch( $contentObjectAttributeID );
        foreach ( $files as $file )
        {
            // Read stored path, move to trash, and read stored path again
            $this->assertNotEquals( $file, null );

            $storedFileInfo = $file->storedFileInfo();
            $storedFilePath = $storedFileInfo['filepath'];
            $version = $file->attribute( 'version' );

            $object->object->removeThis();
            $object->refresh();
            $file = eZBinaryFile::fetch( $contentObjectAttributeID, $version );

            $storedFileInfo = $file->storedFileInfo();
            $storedFilePathAfterTrash = $storedFileInfo['filepath'];

            $this->assertNotEquals( $storedFilePath, $storedFilePathAfterTrash, 'The stored file should be renamed when trashed' );
        }
    }
 /**
  * Regression test for issue 16400
  * @link http://issues.ez.no/16400
  * @return unknown_type
  */
 public function testIssue16400()
 {
     $className = 'Media test class';
     $classIdentifier = 'media_test_class';
     $filePath = 'tests/tests/kernel/datatypes/ezmedia/ezmediatype_regression_issue16400.flv';
     eZFile::create($filePath);
     $attributeName = 'Media';
     $attributeIdentifier = 'media';
     $attributeType = 'ezmedia';
     //1. test method fetchByContentObjectID
     $class = new ezpClass($className, $classIdentifier, $className);
     $class->add($attributeName, $attributeIdentifier, $attributeType);
     $attribute = $class->class->fetchAttributeByIdentifier($attributeIdentifier);
     $attribute->setAttribute('can_translate', 0);
     $class->store();
     $object = new ezpObject($classIdentifier, 2);
     $dataMap = $object->object->dataMap();
     $fileAttribute = $dataMap[$attributeIdentifier];
     $dataType = new eZMediaType();
     $dataType->fromString($fileAttribute, $filePath);
     $fileAttribute->store();
     $object->publish();
     $object->refresh();
     //verify fetchByContentObjectID
     $mediaObject = eZMedia::fetch($fileAttribute->attribute('id'), 1);
     $medias = eZMedia::fetchByContentObjectID($object->object->attribute('id'));
     $this->assertEquals($mediaObject->attribute('filename'), $medias[0]->attribute('filename'));
     $medias = eZMedia::fetchByContentObjectID($object->object->attribute('id'), $fileAttribute->attribute('language_code'));
     $this->assertEquals($mediaObject->attribute('filename'), $medias[0]->attribute('filename'));
     //2. test issue
     // create translation
     $contentObject = $object->object;
     $storedFileName = $mediaObject->attribute('filename');
     $version = $contentObject->createNewVersionIn('nor-NO', $fileAttribute->attribute('language_code'));
     $version->setAttribute('status', eZContentObjectVersion::STATUS_INTERNAL_DRAFT);
     $version->store();
     $version->removeThis();
     $sys = eZSys::instance();
     $dir = $sys->storageDirectory();
     //verify the file is deleted
     $storedFilePath = $dir . '/original/video/' . $storedFileName;
     $file = eZClusterFileHandler::instance($storedFilePath);
     $this->assertTrue($file->exists($storedFilePath));
     if ($file->exists($storedFilePath)) {
         unlink($storedFilePath);
     }
 }
 /**
  * Setup an environment for this test.
  *
  */
 public function setUp()
 {
     parent::setUp();
     // Create a class 1
     $class1 = new ezpClass('Test 1', 'test_1', '<name>');
     $class1->add('Name', 'name');
     $class1->add('Relations', 'relations', 'ezobjectrelationlist');
     $class1->store();
     // Generate class*.php cache files;
     eZContentClass::classIDByIdentifier('test_1');
     // Wait 3 seconds to get the proper timestamps for test
     sleep(3);
     // Create a class 2
     // It marks class-identifier-cache as expired because a new class has been created
     $class2 = new ezpClass('Test 2', 'test_2', '<name>');
     $class2->add('Name', 'name');
     $class2->add('Relations', 'relations', 'ezobjectrelationlist');
     $class2->store();
 }
 public function testIssue18249()
 {
     // setup a class C1 with objectrelationlist and pattern name
     $class1 = new ezpClass('TestClass1', 'testclass1', '<test_name><test_relation>');
     $class1->add('Test name', 'test_name', 'ezstring');
     $class1->add('Test Relation', 'test_relation', 'ezobjectrelationlist');
     $class1->store();
     // create an object O1 with eng and nor
     $o1 = new ezpObject('article', false, 14, 1, 'nor-NO');
     $o1->title = 'Test_NOR';
     $o1->publish();
     $o1->addTranslation('nor-NO', array('title' => 'Test_NOR'));
     // create an object O2 based on C1 with Nor
     $o2 = new ezpObject('testclass1', false, 14, 1, 'nor-NO');
     $o2->test_name = 'name_';
     $o2->test_relation = array($o1->attribute('id'));
     $o2->publish();
     // test O2's name
     $this->assertEquals('name_Test_NOR', $o2->name);
 }
 /**
  * Unit test for eZContentObject::relatedObjects()
  *
  * Outline:
  * 1) Create a content class with ezobjectrelation attribute
  * 2) Create object of that class and relate to another object through the attribute
  * 3) Check that object loaded by eZContentObject::relatedObjects() is the correct one
  */
 public function testRelatedObjectsWithAttributeId()
 {
     // Create a test content class
     $class = new ezpClass(__FUNCTION__, __FUNCTION__, 'name');
     $class->add('Name', 'name', 'ezstring');
     $attributeId = $class->add('Single relation #1', 'relation', 'ezobjectrelation')->attribute('id');
     $class->store();
     // Create an article we will relate our object to
     $article = new ezpObject('article', 2);
     $article->title = "Related object #1 for " . __FUNCTION__;
     $article->publish();
     // Create a test object with attribute relation to created article
     $object = new ezpObject(__FUNCTION__, 2);
     $object->name = __FUNCTION__;
     $object->relation = $article->attribute('id');
     $object->publish();
     $contentObject = eZContentObject::fetch($object->attribute('id'));
     $relatedObjects = $contentObject->relatedObjects(false, false, $attributeId);
     $this->assertCount(1, $relatedObjects);
     $this->assertInstanceOf("eZContentObject", $relatedObjects[0]);
     $this->assertEquals($article->attribute('id'), $relatedObjects[0]->attribute("id"), "Related object is not the expected object");
 }
 /**
  * Unit test for eZContentFunctionCollection::fetchKeyword
  */
 public function testFetchKeyword()
 {
     $class1Identifier = __FUNCTION__ . '_1';
     // First create two content classes with a keyword attribute
     $class1 = new ezpClass($class1Identifier, $class1Identifier, '<title>');
     $class1->add('Title', 'title', 'ezstring');
     $class1->add('Keywords', 'keywords', 'ezkeyword');
     $class1->store();
     $class1ID = $class1->class->attribute('id');
     // Create an instance of each of these classes with attributes
     $object = new ezpObject($class1Identifier, 2);
     $object->title = __FUNCTION__;
     $object->keywords = "keyword1, keyword2, keyword3";
     $object->publish();
     // Fetch keywords for class 1
     $keywords = eZContentFunctionCollection::fetchKeyword('k', $class1ID, 0, 20);
     $this->assertInternalType('array', $keywords);
     $this->assertArrayHasKey('result', $keywords);
     $this->assertInternalType('array', $keywords['result']);
     $this->assertEquals(3, count($keywords['result']));
     foreach ($keywords['result'] as $result) {
         $this->assertInternalType('array', $result);
         $this->assertArrayHasKey('keyword', $result);
         $this->assertArrayHasKey('link_object', $result);
         $this->assertInstanceOf('eZContentObjectTreeNode', $result['link_object']);
     }
 }
    /**
     * Unit test for eZContentObject::relatedObjectCount()
     *
     * Outline:
     * 1) Create a content class with ezobjectrelation and ezobjectrelationlist
     *    attributes
     * 2) Create objects and relate them to each of these attributes and to the
     *    object itself (common)
     * 3) Check that attribute count is correct on each attribute and globally
     */
    public function testRelatedObjectCount()
    {
        // Create a test content class
        $class = new ezpClass( __FUNCTION__, __FUNCTION__, 'name' );
        $class->add( 'Name', 'name', 'ezstring' );
        $attributes['single_relation_1'] =
            $class->add( 'Single relation #1', 'single_relation_1', 'ezobjectrelation' )
            ->attribute( 'id' );
        $attributes['single_relation_2'] =
            $class->add( 'Single relation #2', 'single_relation_2', 'ezobjectrelation' )
            ->attribute( 'id' );
        $attributes['multiple_relations_1'] =
            $class->add( 'Multiple relations #1', 'multiple_relations_1', 'ezobjectrelationlist' )
            ->attribute( 'id' );
        $attributes['multiple_relations_2'] =
            $class->add( 'Multiple relations #2', 'multiple_relations_2', 'ezobjectrelationlist' )
            ->attribute( 'id' );
        $class->store();

        // create a few articles we will relate our object to
        $relatedObjects = array();
        for( $i = 0; $i < 10; $i++ )
        {
            $article = new ezpObject( 'article', 2 );
            $article->title = "Related object #'$i for " . __FUNCTION__;
            $article->publish();
            $relatedObjects[] = $article->attribute( 'id' );
        }

        // Create a test object with various relations (some objects are related
        // to multiple attributes in order to test reverse relations):
        // - 1 relation (IDX 0) on single_relation_1
        // - 1 relation (IDX 1) on single_relation_2
        // - 2 relations (IDX 2, 3) on multiple_relations_1
        // - 2 relations (IDX 4, 5) on multiple_relations_2
        // - 6 object level relations ((IDX 6, 7, 8, 9)
        $object = new ezpObject( __FUNCTION__, 2 );
        $object->name = __FUNCTION__;
        $object->single_relation_1 = $relatedObjects[0];
        $object->single_relation_2 = $relatedObjects[1];
        $object->multiple_relations_1 = array( $relatedObjects[0], $relatedObjects[2], $relatedObjects[3] );
        $object->multiple_relations_2 = array( $relatedObjects[1], $relatedObjects[4], $relatedObjects[5] );
        $object->addContentObjectRelation( $relatedObjects[0] );
        $object->addContentObjectRelation( $relatedObjects[1] );
        $object->addContentObjectRelation( $relatedObjects[6] );
        $object->addContentObjectRelation( $relatedObjects[7] );
        $object->addContentObjectRelation( $relatedObjects[8] );
        $object->addContentObjectRelation( $relatedObjects[9] );
        $object->publish();

        // Create 2 more objects with relations to $relatedObjects[9]
        // in order to test reverse related objects
        $otherObject1 = new ezpObject( __FUNCTION__, 2 );
        $otherObject1->name = "Reverse test object #1 for " . __FUNCTION__;
        $otherObject1->single_relation_1 = $relatedObjects[9];
        $otherObject1->publish();

        $otherObject2 = new ezpObject( __FUNCTION__, 2 );
        $otherObject2->name = "Reverse test object #2 for " . __FUNCTION__;
        $otherObject2->single_relation_2 = $relatedObjects[9];
        $otherObject2->publish();

        $contentObject = eZContentObject::fetch( $object->attribute( 'id' ) );

        $paramAllRelations = array( 'AllRelations' => true );
        $paramAttributeRelations = array( 'AllRelations' => eZContentObject::RELATION_ATTRIBUTE );
        $paramCommonRelations = array( 'AllRelations' => eZContentObject::RELATION_COMMON );

        // Test overall relation count
        $this->assertEquals(
            14, $contentObject->relatedObjectCount( false, false, false, $paramAllRelations ),
            "Overall relation count should be 14" );

        // Test relation count for each attribute
        $this->assertEquals(
            1, $contentObject->relatedObjectCount( false, $attributes['single_relation_1'], false, $paramAttributeRelations ),
            "Relation count on attribute single_relation_1 should be 1" );
        $this->assertEquals(
            1, $contentObject->relatedObjectCount( false, $attributes['single_relation_2'], false, $paramAttributeRelations ),
            "Relation count on attribute single_relation_2 should be 1" );
        $this->assertEquals(
            3, $contentObject->relatedObjectCount( false, $attributes['multiple_relations_1'], false, $paramAttributeRelations ),
            "Relation count on attribute multiple_relations_1 should be 3" );
        $this->assertEquals(
            3, $contentObject->relatedObjectCount( false, $attributes['multiple_relations_2'], false, $paramAttributeRelations ),
            "Relation count on attribute multiple_relations_2 should be 3" );

        // Test common level relation count
        $this->assertEquals(
            6, $contentObject->relatedObjectCount( false, false, false, $paramCommonRelations ),
            "Common relations count should be 6" );

        // Test reverse relation count on $relatedObject[9]
        // This object is related to:
        // - the main $object on common level
        // - one object on single_relation_1
        // - another object on single_relation_2
        $relatedContentObject = eZContentObject::fetch( $relatedObjects[9] );
        $this->assertEquals(
            3, $relatedContentObject->relatedObjectCount( false, false, true, $paramAllRelations ),
            "Overall reverse relation count should be 3" );
        $this->assertEquals(
            1, $relatedContentObject->relatedObjectCount( false, false, true, $paramCommonRelations ),
            "Common reverse relation count should be 1" );
        $this->assertEquals(
            1, $relatedContentObject->relatedObjectCount( false, $attributes['single_relation_1'], true, $paramAttributeRelations ),
            "Attribute reverse relation count on single_relation_1 should be 1" );
        $this->assertEquals(
            1, $relatedContentObject->relatedObjectCount( false, $attributes['single_relation_2'], true, $paramAttributeRelations ),
            "Attribute reverse relation count on single_relation_2 should be 1" );

        // Test that trashed objects are not counted as related (issue #15142)
        $trashObject = eZContentObject::fetch( $relatedObjects[9] );
        $trashObject->removeThis();
        $this->assertEquals(
            13, $contentObject->relatedObjectCount( false, false, false, $paramAllRelations ),
            "Relation count after move to trash should be 13" );

        // Empty the trash
        foreach( eZContentObjectTrashNode::trashList() as $node )
        {
            eZContentObjectTrashNode::purgeForObject( $node->attribute( 'contentobject_id' ) );
        }
    }
 /**
  * Unit test for eZContentFunctionCollection::fetchKeyword
  */
 public function testFetchKeyword()
 {
     $class1Identifier = __FUNCTION__ . '_1';
     // First create two content classes with a keyword attribute
     $class1 = new ezpClass($class1Identifier, $class1Identifier, '<title>');
     $class1->add('Title', 'title', 'ezstring');
     $class1->add('Keywords', 'keywords', 'ezkeyword');
     $class1->store();
     $class1ID = $class1->class->attribute('id');
     // Create placeholder folders for objects
     $folder1 = new ezpObject('folder', 2);
     $folder1->title = __FUNCTION__ . ' A';
     $folder1->publish();
     $folder2 = new ezpObject('folder', 2);
     $folder2->title = __FUNCTION__ . ' B';
     $folder2->publish();
     $folder3 = new ezpObject('folder', $folder1->mainNode->node_id);
     $folder3->title = __FUNCTION__ . ' A';
     $folder3->publish();
     // Create an objects to test function
     $object0 = new ezpObject($class1Identifier, 2);
     $object0->title = __FUNCTION__ . ' A ';
     $object0->keywords = "keyword1, keyword2, keyword3";
     $object0->publish();
     $object1 = new ezpObject($class1Identifier, $folder1->mainNode->node_id);
     $object1->title = __FUNCTION__ . ' A ';
     $object1->keywords = "keyword1, keyword2, keyword3";
     $object1->publish();
     $object2 = new ezpObject($class1Identifier, $folder2->mainNode->node_id);
     $object2->title = __FUNCTION__ . ' C ';
     $object2->keywords = "keyword1, keyword2, keyword3";
     $object2->publish();
     $object3 = new ezpObject($class1Identifier, $folder3->mainNode->node_id);
     $object3->title = __FUNCTION__ . ' D ';
     $object3->keywords = "keyword1, keyword2, keyword3";
     $object3->publish();
     // Fetch keywords for class 1, on all scope
     $keywords = eZContentFunctionCollection::fetchKeyword('k', $class1ID, 0, 20);
     $this->assertInternalType('array', $keywords);
     $this->assertArrayHasKey('result', $keywords);
     $this->assertInternalType('array', $keywords['result']);
     $this->assertEquals(12, count($keywords['result']));
     foreach ($keywords['result'] as $result) {
         $this->assertInternalType('array', $result);
         $this->assertArrayHasKey('keyword', $result);
         $this->assertArrayHasKey('link_object', $result);
         $this->assertInstanceOf('eZContentObjectTreeNode', $result['link_object']);
     }
     // Fetch keyword1 for class 1, not specifying parent node
     $keywords = eZContentFunctionCollection::fetchKeyword('keyword1', $class1ID, 0, 20);
     $this->assertInternalType('array', $keywords);
     $this->assertArrayHasKey('result', $keywords);
     $this->assertInternalType('array', $keywords['result']);
     $this->assertEquals(4, count($keywords['result']));
     foreach ($keywords['result'] as $result) {
         $this->assertInternalType('array', $result);
         $this->assertArrayHasKey('keyword', $result);
         $this->assertArrayHasKey('link_object', $result);
         $this->assertInstanceOf('eZContentObjectTreeNode', $result['link_object']);
     }
     // Fetch keyword1 for class 1, directly below parentNodeId (rootNode)
     $keywords = eZContentFunctionCollection::fetchKeyword('keyword1', $class1ID, 0, 20, false, array(), 2);
     $this->assertInternalType('array', $keywords);
     $this->assertArrayHasKey('result', $keywords);
     $this->assertInternalType('array', $keywords['result']);
     $this->assertEquals(1, count($keywords['result']));
     foreach ($keywords['result'] as $result) {
         $this->assertInternalType('array', $result);
         $this->assertArrayHasKey('keyword', $result);
         $this->assertArrayHasKey('link_object', $result);
         $this->assertInstanceOf('eZContentObjectTreeNode', $result['link_object']);
     }
     // Fetch keywords for class 1, directly below parentNodeId (specific folder)
     $keywords = eZContentFunctionCollection::fetchKeyword('keyword1', $class1ID, 0, 20, false, array(), $folder1->mainNode->node_id);
     $this->assertInternalType('array', $keywords);
     $this->assertArrayHasKey('result', $keywords);
     $this->assertInternalType('array', $keywords['result']);
     $this->assertEquals(1, count($keywords['result']));
     foreach ($keywords['result'] as $result) {
         $this->assertInternalType('array', $result);
         $this->assertArrayHasKey('keyword', $result);
         $this->assertArrayHasKey('link_object', $result);
         $this->assertInstanceOf('eZContentObjectTreeNode', $result['link_object']);
     }
     // Fetch keywords for class 1, from root folder, with depth equal to 2
     $keywords = eZContentFunctionCollection::fetchKeyword('keyword1', $class1ID, 0, 20, false, array(), 2, true, false, 2);
     $this->assertInternalType('array', $keywords);
     $this->assertArrayHasKey('result', $keywords);
     $this->assertInternalType('array', $keywords['result']);
     $this->assertEquals(3, count($keywords['result']));
     foreach ($keywords['result'] as $result) {
         $this->assertInternalType('array', $result);
         $this->assertArrayHasKey('keyword', $result);
         $this->assertArrayHasKey('link_object', $result);
         $this->assertInstanceOf('eZContentObjectTreeNode', $result['link_object']);
     }
     // Fetch keywords for class 1, from sepecific node, with depth equal to 2
     $keywords = eZContentFunctionCollection::fetchKeyword('keyword1', $class1ID, 0, 20, false, array(), $folder1->mainNode->node_id, true, false, 2);
     $this->assertInternalType('array', $keywords);
     $this->assertArrayHasKey('result', $keywords);
     $this->assertInternalType('array', $keywords['result']);
     $this->assertEquals(2, count($keywords['result']));
     foreach ($keywords['result'] as $result) {
         $this->assertInternalType('array', $result);
         $this->assertArrayHasKey('keyword', $result);
         $this->assertArrayHasKey('link_object', $result);
         $this->assertInstanceOf('eZContentObjectTreeNode', $result['link_object']);
     }
     // Fetch keywords for class 1, from root folder, with depth equal to 0 (unlimited)
     $keywords = eZContentFunctionCollection::fetchKeyword('keyword1', $class1ID, 0, 20, false, array(), 2, true, false, 0);
     $this->assertInternalType('array', $keywords);
     $this->assertArrayHasKey('result', $keywords);
     $this->assertInternalType('array', $keywords['result']);
     $this->assertEquals(4, count($keywords['result']));
     foreach ($keywords['result'] as $result) {
         $this->assertInternalType('array', $result);
         $this->assertArrayHasKey('keyword', $result);
         $this->assertArrayHasKey('link_object', $result);
         $this->assertInstanceOf('eZContentObjectTreeNode', $result['link_object']);
     }
     // Fetch keywords for class 1, from specific folder, with depth equal to 0 (unlimited)
     $keywords = eZContentFunctionCollection::fetchKeyword('keyword1', $class1ID, 0, 20, false, array(), $folder1->mainNode->node_id, true, false, 0);
     $this->assertInternalType('array', $keywords);
     $this->assertArrayHasKey('result', $keywords);
     $this->assertInternalType('array', $keywords['result']);
     $this->assertEquals(2, count($keywords['result']));
     foreach ($keywords['result'] as $result) {
         $this->assertInternalType('array', $result);
         $this->assertArrayHasKey('keyword', $result);
         $this->assertArrayHasKey('link_object', $result);
         $this->assertInstanceOf('eZContentObjectTreeNode', $result['link_object']);
     }
 }