/** * test orders * * @return void */ public function testOrders() { $handler = $this->handler; $proxy = m::mock('Xpressengine\\DynamicField\\DatabaseProxy', [$handler])->shouldAllowMockingProtectedMethods()->makePartial(); $config = $this->getConfigEntity(); $config->shouldReceive('get')->with('typeId')->andReturn('id'); $config->shouldReceive('get')->with('use')->andReturn(true); $query = m::mock('Illuminate\\Database\\Query\\Builder'); $type = m::mock('Type', 'Xpressengine\\DynamicField\\AbstractType'); $type->shouldReceive('setConfig'); $type->shouldReceive('orders')->andReturn($query); $this->configHandler->shouldReceive('gets')->andReturn([$config]); $this->registerHandler->shouldReceive('getType')->andReturn($type); $result = $proxy->orders($query, []); $this->assertInstanceOf('Illuminate\\Database\\Query\\Builder', $result); }