Ejemplo n.º 1
0
 public function test_resource_filter()
 {
     // Create resource
     $resource = new pytin\Resource(array('name' => 'Test filter 1', 'type' => 'assets.Datacenter', 'status' => 'inuse', 'options' => array(array('name' => 'address1', 'value' => '192.168.1.101'))));
     $resource->save();
     $resource = new pytin\Resource(array('name' => 'Test filter 2', 'type' => 'assets.Datacenter', 'status' => 'free', 'options' => array(array('name' => 'address1', 'value' => '192.168.1.111'))));
     $resource->save();
     // Search by model fields exact match
     $resources = pytin\Resource::filter(array('name' => 'Test filter 2', 'status' => 'free'));
     $this->assertEquals(1, count($resources));
 }
Ejemplo n.º 2
0
 public function testResourceFilter()
 {
     // Create resource
     $resource = new pytin\Resource(array('name' => 'Test filter 1', 'type' => 'ipman.IPAddress', 'status' => 'inuse', 'options' => array(array('name' => 'address1', 'value' => '192.168.1.101'))));
     $resource->save();
     $resource = new pytin\Resource(array('name' => 'Test filter 2', 'type' => 'ipman.IPAddress', 'status' => 'free', 'options' => array(array('name' => 'address1', 'value' => '192.168.1.111'))));
     $resource->save();
     // Search by model fields exact match
     $resources = pytin\Resource::filter(array('name' => 'Test filter 2', 'status' => 'free'));
     $this->assertEquals(1, count($resources));
     // More complex searches is not implemented yet
 }