Ejemplo n.º 1
0
 public function setUp()
 {
     parent::setUp();
     $this->client = mock('FullTextSearch_IIndexDocuments');
     $this->permissions_manager = mock('Docman_PermissionsItemManager');
     $this->actions = new FullTextSearchActions($this->client, $this->permissions_manager);
     $this->item = aDocman_File()->withId(101)->withTitle('Coin')->withDescription('Duck typing')->withGroupId(200)->build();
     stub($this->permissions_manager)->exportPermissions($this->item)->returns(array(3, 102));
     $version = stub('Docman_Version')->getPath()->returns(dirname(__FILE__) . '/_fixtures/file.txt');
     $this->params = aSetOfParameters()->withItem($this->item)->withVersion($version)->build();
 }
 public function setUp()
 {
     parent::setUp();
     $this->client = partial_mock('ElasticSearch_IndexClientFacade', array('index', 'update', 'delete', 'getMapping', 'setMapping', 'getIndexedElement'));
     $this->item_factory = mock('Docman_ItemFactory');
     Docman_ItemFactory::setInstance(200, $this->item_factory);
     $this->permissions_manager = mock('Docman_PermissionsItemManager');
     $metadata01 = stub('Docman_Metadata')->getId()->returns(1);
     $metadata02 = stub('Docman_Metadata')->getId()->returns(2);
     $hardcoded_metadata_title = stub('Docman_Metadata')->getLabel()->returns('title');
     stub($hardcoded_metadata_title)->getType()->returns(PLUGIN_DOCMAN_METADATA_TYPE_STRING);
     $hardcoded_metadata_description = stub('Docman_Metadata')->getLabel()->returns('description');
     stub($hardcoded_metadata_description)->getType()->returns(PLUGIN_DOCMAN_METADATA_TYPE_TEXT);
     $hardcoded_metadata_owner = stub('Docman_Metadata')->getLabel()->returns('owner');
     stub($hardcoded_metadata_owner)->getType()->returns(PLUGIN_DOCMAN_METADATA_TYPE_STRING);
     $hardcoded_metadata_create_date = stub('Docman_Metadata')->getLabel()->returns('create_date');
     stub($hardcoded_metadata_create_date)->getType()->returns(PLUGIN_DOCMAN_METADATA_TYPE_DATE);
     $hardcoded_metadata_update_date = stub('Docman_Metadata')->getLabel()->returns('update_date');
     stub($hardcoded_metadata_update_date)->getType()->returns(PLUGIN_DOCMAN_METADATA_TYPE_DATE);
     $hardcoded_metadata_status = stub('Docman_Metadata')->getLabel()->returns('status');
     stub($hardcoded_metadata_status)->getType()->returns(PLUGIN_DOCMAN_METADATA_TYPE_LIST);
     $hardcoded_metadata_obsolescence_date = stub('Docman_Metadata')->getLabel()->returns('obsolescence_date');
     stub($hardcoded_metadata_obsolescence_date)->getType()->returns(PLUGIN_DOCMAN_METADATA_TYPE_DATE);
     $hardcoded_metadata = array($hardcoded_metadata_title, $hardcoded_metadata_description, $hardcoded_metadata_owner, $hardcoded_metadata_create_date, $hardcoded_metadata_update_date, $hardcoded_metadata_update_date, $hardcoded_metadata_obsolescence_date);
     $this->item = aDocman_File()->withId(101)->withTitle('Coin')->withOwnerId(123)->withDescription('Duck typing')->withGroupId(200)->build();
     stub($this->item)->getCreateDate()->returns(1403160945);
     stub($this->item)->getUpdateDate()->returns(1403160949);
     $first_search_type = array(PLUGIN_DOCMAN_METADATA_TYPE_TEXT, PLUGIN_DOCMAN_METADATA_TYPE_STRING);
     $this->metadata_factory = stub('Docman_MetadataFactory')->getRealMetadataList(false, $first_search_type)->returns(array($metadata01, $metadata02));
     stub($this->metadata_factory)->getHardCodedMetadataList()->returns($hardcoded_metadata);
     stub($this->metadata_factory)->getMetadataValue($this->item, $metadata01)->returns('val01');
     stub($this->metadata_factory)->getMetadataValue($this->item, $metadata02)->returns('val02');
     $this->approval_table_factories_factory = mock('Docman_ApprovalTableFactoriesFactory');
     stub($this->approval_table_factories_factory)->getSpecificFactoryFromItem($this->item)->returns(mock('Docman_ApprovalTableFileFactory'));
     $this->request_data_factory = new ElasticSearch_1_2_RequestDocmanDataFactory($this->metadata_factory, $this->permissions_manager, $this->approval_table_factories_factory);
     $max_indexed_file_size = 9;
     //our valid test file is 8 bits in size
     $this->actions = new FullTextSearchDocmanActions($this->client, $this->request_data_factory, mock('BackendLogger'), $max_indexed_file_size);
     stub($this->permissions_manager)->exportPermissions($this->item)->returns(array(3, 102));
     $this->version = stub('Docman_Version')->getPath()->returns(dirname(__FILE__) . '/_fixtures/file.txt');
     $this->big_version = stub('Docman_Version')->getPath()->returns(dirname(__FILE__) . '/_fixtures/big_file.txt');
     $this->params = aSetOfParameters()->withItem($this->item)->withVersion($this->version)->build();
 }
Ejemplo n.º 3
0
 public function setUp()
 {
     parent::setUp();
     $this->other_item = aDocman_File()->withId(101)->withTitle('Coin')->withDescription('Duck typing')->withGroupId(200)->build();
     $this->approval_table_file_factory = mock('Docman_ApprovalTableFileFactory');
     $this->version = mock('Docman_Version');
 }