示例#1
0
 public function testFieldsCanBeSearched()
 {
     $mockBuilder = m::mock('Illuminate\\Database\\Query\\Builder');
     $mockBuilder->shouldReceive('select')->with(array('column1', 'column2', 'field1', 'field2'))->once()->andReturn($mockBuilder);
     $mockBuilder->shouldReceive('where')->withArgs(array('field1', '=', '1234'))->once();
     $mockBuilder->shouldReceive('where')->withArgs(array('field2', 'LIKE', '4321'))->once();
     $mockDb = $this->mock($mockBuilder, true);
     $obj = new Scaffold($mockDb, self::TEST_TABLE);
     $obj->addElements(array('field1' => array(), 'field2' => array()));
     $this->assertInstanceOf('Illuminate\\Database\\Query\\Builder', $obj->search(array(array('field1', '=', '1234'), array('field2', 'LIKE', '4321'))));
 }