/**
  * Simple test that will test if the immutable object is created as wished
  */
 public function testBasicColumnConfiguration()
 {
     $name = "fooBar";
     $cc = ColumnConfigurationBuilder::create()->name($name)->searchable(Searchable::REGEX())->orderable(Orderable::NONE())->build();
     $this->assertSame($name, $cc->getName(), "Name should be set correctly");
     $this->assertTrue($cc->getSearch()->isSearchable(), "The column should be searchable");
     $this->assertFalse($cc->getOrder()->isOrderable(), "The column should be orderable");
 }
 /**
  * Will test if the query parser will ignore search and order advise if the columns forbid them
  *
  */
 public function testWrongParsing()
 {
     // create columnconfiguration
     $column = ColumnConfigurationBuilder::create()->name("fooBar")->orderable(Orderable::NONE())->searchable(Searchable::NONE())->build();
     $conf = $this->parser->parse($this->request, [$column]);
     // assert column search
     $this->assertCount(0, $conf->searchColumns());
     // assert column order
     $this->assertCount(0, $conf->orderColumns());
 }
 /**
  * Will check if the column method with the name and a callable as well as the searchable and orderable flag has
  * all values set to the right defaults
  */
 public function testNameFunctionSearchableOrderableColumn()
 {
     $name = "fooBar";
     $callable = function ($data) {
         return "bar";
     };
     $this->composer->column($name, $callable, Searchable::NONE(), Orderable::NONE());
     // get configuration and verify
     $numberOfColumns = count($this->composer->getColumnConfiguration());
     $this->assertSame($numberOfColumns, 1, "There should only be one column configuration");
     /**
      * @var ColumnConfiguration
      */
     $cc = $this->composer->getColumnConfiguration()[0];
     /**
      * @var callable
      */
     $func = $cc->getCallable();
     $this->assertTrue($cc->getSearch()->isSearchable(), "The column should not be searchable");
     $this->assertTrue($cc->getOrder()->isOrderable(), "The column should be orderable");
     $this->assertSame($name, $cc->getName(), "The name should be set to 'fooBar'");
     $this->assertSame("bar", $func("fooBar"));
 }