Esempio n. 1
0
 public function setUp()
 {
     $this->column = $this->getMockBuilder('ZfcDatagrid\\Column\\Select')->disableOriginalConstructor()->getMock();
     $this->column->method('getSelectPart1')->willReturn('myCol');
     $this->column->method('getType')->willReturn(new \ZfcDatagrid\Column\Type\PhpString());
     $this->column->setUniqueId('myCol');
     $this->column->setSelect('myCol');
     $this->column2 = $this->getMockBuilder('ZfcDatagrid\\Column\\Select')->disableOriginalConstructor()->getMock();
     $this->column2->method('getSelectPart1')->willReturn('myCol2');
     $this->column2->method('getType')->willReturn(new \ZfcDatagrid\Column\Type\PhpString());
     $this->column2->setUniqueId('myCol2');
     $this->column2->setSelect('myCol2');
     $this->mockDriver = $this->getMock('Zend\\Db\\Adapter\\Driver\\DriverInterface');
     $this->mockConnection = $this->getMock('Zend\\Db\\Adapter\\Driver\\ConnectionInterface');
     $this->mockDriver->expects($this->any())->method('checkEnvironment')->will($this->returnValue(true));
     $this->mockDriver->expects($this->any())->method('getConnection')->will($this->returnValue($this->mockConnection));
     $this->mockPlatform = $this->getMock('Zend\\Db\\Adapter\\Platform\\PlatformInterface');
     $this->mockStatement = $this->getMock('Zend\\Db\\Adapter\\Driver\\StatementInterface');
     $this->mockDriver->expects($this->any())->method('createStatement')->will($this->returnValue($this->mockStatement));
     $this->adapter = new Adapter($this->mockDriver, $this->mockPlatform);
     $sql = new Sql($this->adapter, 'foo');
     $select = new Select('myTable');
     $select->columns(['myCol', 'myCol2']);
     $this->filterSelect = new FilterSelect($sql, $select);
 }
Esempio n. 2
0
 public function setUp()
 {
     $this->column = $this->getMockForAbstractClass('ZfcDatagrid\\Column\\AbstractColumn');
     $this->column->setUniqueId('myCol');
     $this->column->setSelect('myCol');
     $this->column2 = $this->getMockForAbstractClass('ZfcDatagrid\\Column\\AbstractColumn');
     $this->column2->setUniqueId('myCol2');
     $this->column2->setSelect('myCol2');
     $this->mockDriver = $this->getMock('Zend\\Db\\Adapter\\Driver\\DriverInterface');
     $this->mockConnection = $this->getMock('Zend\\Db\\Adapter\\Driver\\ConnectionInterface');
     $this->mockDriver->expects($this->any())->method('checkEnvironment')->will($this->returnValue(true));
     $this->mockDriver->expects($this->any())->method('getConnection')->will($this->returnValue($this->mockConnection));
     $this->mockPlatform = $this->getMock('Zend\\Db\\Adapter\\Platform\\PlatformInterface');
     $this->mockStatement = $this->getMock('Zend\\Db\\Adapter\\Driver\\StatementInterface');
     $this->mockDriver->expects($this->any())->method('createStatement')->will($this->returnValue($this->mockStatement));
     $this->adapter = new Adapter($this->mockDriver, $this->mockPlatform);
     $sql = new Sql($this->adapter, 'foo');
     $select = new Select('myTable');
     $select->columns(['myCol', 'myCol2']);
     $this->filterSelect = new FilterSelect($sql, $select);
 }