Example #1
0
 public function testCanOptionallySupplyCustomRenderer()
 {
     $fields = new Fields();
     $fields->add('custom')->setVisible(true)->setLabel('Custom')->assignHelperCallback('CsvCell.Content', function ($helper, $rowData) {
         return 'shouldnotberendered';
     })->add('not_visible')->setVisible(false)->setLabel('Unseen')->assignHelperCallback('CsvCell.Content', function ($helper, $rowData) {
         return 'content.unseen';
     });
     $renderer = $this->view->csvCellRenderer();
     $renderer->getContentRenderer()->assign('custom', function ($helper, $rowData) {
         return 'customrendering';
     });
     $output = $this->csvExportViewHelper->direct($fields, array(array('test_field' => 'FAFAFAFA')), $renderer);
     $this->assertContains('customrendering', $output);
     $this->assertNotContains('shouldnotberenderered', $output);
 }
 public function testUsage()
 {
     /* @var $csvCellFieldHelper \Dewdrop\Fields\Helper\CsvCell */
     $csvCellFieldHelper = $this->view->csvCellRenderer();
     $this->assertInstanceOf('\\Dewdrop\\Fields\\Helper\\CsvCell', $csvCellFieldHelper);
 }