/**
  * @return \Cubiche\Core\Specification\SpecificationInterface
  */
 protected function newRandomSpecification()
 {
     switch (\rand(0, 3)) {
         case 0:
             return Criteria::eq(5);
         case 1:
             return Criteria::gte(5);
         case 2:
             return Criteria::property('foo')->lte(10);
         case 3:
         default:
             return Criteria::false();
     }
 }
 public function testFilteredDataSource()
 {
     $this->given($searchCriteria = Criteria::false(), $emptyDataSource = $this->emptyDataSource())->then->boolean($emptyDataSource->isFiltered())->isFalse()->and->when($filteredDataSource = $emptyDataSource->filteredDataSource($searchCriteria))->then->boolean($filteredDataSource->isFiltered())->isTrue()->variable($filteredDataSource->searchCriteria())->isEqualTo($searchCriteria);
     $this->given($searchCriteria = Criteria::true(), $filteredCriteria = Criteria::false(), $randomDataSource = $this->randomDataSource($searchCriteria))->then->boolean($randomDataSource->isFiltered())->isTrue()->and->when($filteredDataSource = $randomDataSource->filteredDataSource($filteredCriteria))->then->boolean($filteredDataSource->isFiltered())->isTrue()->variable($filteredDataSource->searchCriteria())->isEqualTo($searchCriteria->andX($filteredCriteria));
 }
 /**
  * Test visitValue.
  */
 public function testVisitValue()
 {
     $this->notSupportedOperationTest(Criteria::false()->selector());
 }
Esempio n. 4
0
 public function testIsFiltered()
 {
     $this->given($datasource = $this->randomDataSource())->then->boolean($datasource->isFiltered())->isFalse()->given($searchCriteria = Criteria::false(), $datasource = $this->randomDataSource($searchCriteria))->then->boolean($datasource->isFiltered())->isTrue();
 }
Esempio n. 5
0
 /**
  * Test false.
  */
 public function testFalse()
 {
     $this->valueSelectorTest(Criteria::false(), false);
 }