silverstripe-dms/tests/Stub/StubRelatedDocumentExtension.php
Franco Springveldt 6b25237ec6 NEW Query Builder functionality added
This enhancement adds the ability to add documents to a document set based on a list of filters added from DMSDocument. Fixes #96
2017-05-16 13:26:01 +12:00

46 lines
1.0 KiB
PHP

<?php
/**
* Class StubRelatedDocumentExtension
*
* @package dms
*/
class StubRelatedDocumentExtension extends DataExtension implements TestOnly
{
/**
* For method {@link DMSDocument::getRelatedDocuments}
*
* @param ArrayList $relatedDocuments
* @return ArrayList
*/
public function updateRelatedDocuments($relatedDocuments)
{
$relatedDocuments->push($this->getFakeDocument());
return $relatedDocuments;
}
/**
* For method {@link DMSDocumentSet::getDocuments}
*
* @param ArrayList $relatedDocuments
* @return ArrayList
*/
public function updateDocuments($documents)
{
$documents->push($this->getFakeDocument());
return $documents;
}
/**
* Return a dummy document for testing purposes
*
* @return DMSDocument
*/
protected function getFakeDocument()
{
$fakeDocument = new DMSDocument;
$fakeDocument->Filename = 'Extended';
return $fakeDocument;
}
}