/** * test get type * * @return void */ public function testGetType() { $conn = $this->conn; $configHandler = $this->configHandler; $registerHandler = $this->registerHandler; $view = $this->view; $handler = new DynamicFieldHandler($conn, $configHandler, $registerHandler, $view); $group = 'group'; $id = 'id'; $configHandler->shouldReceive('get')->once()->andReturn(null); $result = $handler->getType($group, $id); $this->assertNull($result); $config = $this->getConfigEntity(); $config->shouldReceive('get')->with('typeId')->andReturn('type'); $configHandler->shouldReceive('get')->once()->andReturn($config); $type = m::mock('Type', 'Xpressengine\\DynamicField\\AbstractType'); $type->shouldReceive('setConfig'); $registerHandler->shouldReceive('getType')->andReturn($type); $result = $handler->getType($group, $id); $this->assertInstanceOf('Xpressengine\\DynamicField\\AbstractType', $result); }