示例#1
0
 public function testManualVersionSet()
 {
     /** @var Version $version */
     $version = Mockery::mock('OpenSkill\\Datatable\\Versions\\Datatable19Version');
     $versionEngine = new VersionEngine([]);
     $versionEngine->setVersion($version);
     $this->assertTrue($versionEngine->hasVersion());
     $this->assertSame($version, $versionEngine->getVersion());
 }
示例#2
0
 /**
  * Will return a default DatatableView with no columns defined, but with the view and the version prepared.
  * The user is responsible to populate the view with the wished columns, because they can not be derived from
  * the server side column configuration.
  *
  * @param string $tableView the name of the table view to render
  * @param string $scriptView the name of the script view to render
  *
  * @return DatatableView the view to work with
  */
 public function view($tableView = null, $scriptView = null)
 {
     if (is_null($tableView)) {
         $tableView = $this->versionEngine->getVersion()->tableView();
     }
     if (is_null($scriptView)) {
         $scriptView = $this->versionEngine->getVersion()->scriptView();
     }
     return new DatatableView($tableView, $scriptView, $this->viewFactory, $this->configRepository, []);
 }
示例#3
0
 /**
  * Tests for issue #26 (https://github.com/OpenSkill/Datatable/issues/26)
  * Datatable 1.10 would always be selected, even if the query was for
  * Datatable 1.9
  */
 public function testGivesDatatable19Version()
 {
     $query = new Request(['sEcho' => '6', 'iColumns' => '2', 'sColumns' => '', 'iDisplayStart' => '0', 'iDisplayLength' => '10', 'mDataProp_0' => 'id', 'mDataProp_1' => 'name', 'sSearch' => '', 'bRegex' => 'false', 'sSearch_0' => '', 'bRegex_0' => 'false', 'bSearchable_0' => 'true', 'sSearch_1' => '', 'bRegex_1' => 'false', 'bSearchable_1' => 'true', 'iSortCol_0' => '0', 'sSortDir_0' => 'asc', 'iSortingCols' => '1', 'bSortable_0' => 'true', 'bSortable_1' => 'true', '_' => '1456903066843']);
     $requestStack = Mockery::mock('Symfony\\Component\\HttpFoundation\\RequestStack');
     $requestStack->shouldReceive('getCurrentRequest')->andReturn($query);
     $dt = new Datatable19Version($requestStack);
     $dt2 = new Datatable110Version($requestStack);
     $versionEngine = new VersionEngine([$dt2, $dt]);
     $this->assertTrue($versionEngine->hasVersion());
     $this->assertTrue($versionEngine->getVersion()->canParseRequest());
     $this->assertSame($dt, $versionEngine->getVersion());
 }
示例#4
0
 /**
  * Will return a default DatatableView with no columns defined, but with the view and the version prepared.
  * The user is responsible to populate the view with the wished columns, because they can not be derived from
  * the server side column configuration.
  *
  * @param string $view the view for the table
  * @return DatatableView the view to work with
  */
 public function view($view = null)
 {
     return new DatatableView($view, $this->versionEngine->getVersion());
 }
示例#5
0
 /**
  * @param string $tableView the view to use or null if the standard view should be used for the table and the script
  * @param string $scriptView the view to use or null if the standard view should be used for the table and the script
  */
 public function view($tableView = null, $scriptView = null)
 {
     new DatatableView($tableView, $scriptView, $this->versionEngine->getVersion(), $this->columnConfigurations);
 }