Example #1
0
 public function testServicesSearch()
 {
     $this->object->set('testDef', ScalarDefinition::factory('definitionDataTest')->setData(array('dataOne' => true, 'text' => 'hello John')));
     $this->object->set('testDef2', ScalarDefinition::factory('definitionDataTest')->setData(array('dataOne' => false, 'text' => 'hello Doe')));
     $this->object->set('testDef3', ScalarDefinition::factory('definitionDataTest')->setData(array('dataTwo' => false, 'text' => 'Hey guys!')));
     $results = $this->object->search(array('dataOne' => true));
     $this->assertEquals(1, count($results));
     $this->assertArrayHasKey('testDef', $results);
     $results = $this->object->search(array('dataOne' => false));
     $this->assertEquals(1, count($results));
     $this->assertArrayHasKey('testDef2', $results);
     $results = $this->object->search(array('nothing'));
     $this->assertEquals(0, count($results));
     $results = $this->object->search(array('text' => 'hello*'));
     $this->assertEquals(2, count($results));
     $this->assertArrayHasKey('testDef', $results);
     $this->assertArrayHasKey('testDef2', $results);
     $results = $this->object->search(array('text' => '*guys?'));
     $this->assertEquals(1, count($results));
     $this->assertArrayHasKey('testDef3', $results);
 }