FIX Fixing test errors

This commit is contained in:
Daniel Hensby 2016-11-10 13:01:37 +00:00
parent 537f4da88f
commit 804ff7c247
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E
2 changed files with 6 additions and 4 deletions

View File

@ -328,7 +328,7 @@ class Report extends ViewableData
* Generally, you should override {@link columns()} and {@link records()} to make your report,
* but if they aren't sufficiently flexible, then you can override this method.
*
* @return FormField subclass
* @return \SilverStripe\Forms\FormField subclass
*/
public function getReportField()
{
@ -373,8 +373,9 @@ class Report extends ViewableData
if ($item instanceof CMSPreviewable) {
/** @var CMSPreviewable $item */
return sprintf(
'<a class="grid-field__link-block" href="%s">%s</a>',
'<a class="grid-field__link-block" href="%s" title="%s">%s</a>',
Convert::raw2att($item->CMSEditLink()),
Convert::raw2att($value),
Convert::raw2xml($value)
);
}

View File

@ -8,6 +8,7 @@ use SilverStripe\Control\Session;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Admin\CMSPreviewable ;
use SilverStripe\Forms\GridField\GridFieldDataColumns;
/**
@ -98,14 +99,14 @@ class ReportTest extends SapphireTest
/** @var GridField $gridField */
$gridField = $report->getReportField();
/** @var GridFieldDataColumns $columns */
$columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
$columns = $gridField->getConfig()->getComponentByType(GridFieldDataColumns::class);
$page = new ReportTest_FakeObject();
$page->Title = 'My Object';
$page->ID = 959547;
$titleContent = $columns->getColumnContent($gridField, $page, 'Title');
$this->assertEquals('<a href="dummy-edit-link/959547" title="My Object">My Object</a>', $titleContent);
$this->assertEquals('<a class="grid-field__link-block" href="dummy-edit-link/959547" title="My Object">My Object</a>', $titleContent);
}
}