FOSSology  4.4.0
Open Source License Compliance by Open Source Software
ui-picker-Test.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2011 Hewlett-Packard Development Company, L.P.
4  SPDX-FileCopyrightText: © 2014 Siemens AG
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
9 use Mockery as M;
10 
11 $wwwPath = dirname(dirname(__DIR__));
12 global $container;
13 $container = M::mock('ContainerBuilder');
14 $container->shouldReceive('get');
15 require_once(dirname($wwwPath).'/lib/php/Plugin/FO_Plugin.php');
16 if(!function_exists('register_plugin')){ function register_plugin(){}}
17 require_once ($wwwPath.'/ui/ui-picker.php');
18 
19 class ui_picker_Test extends \PHPUnit\Framework\TestCase
20 {
24  public function test_Uploadtree2PathStr (){
25  global $container;
26  $container = M::mock('ContainerBuilder');
27  $container->shouldReceive('get');
28  $uiPicker = new ui_picker();
29 
30  $reflection = new \ReflectionClass( get_class($uiPicker) );
31  $method = $reflection->getMethod('Uploadtree2PathStr');
32  $method->setAccessible(true);
33 
34  $result = $method->invoke($uiPicker,array(array('ufile_name'=>'path'),array('ufile_name'=>'to'),array('ufile_name'=>'nowhere')));
35  assertThat($result, is('/path/to/nowhere'));
36  }
37 
38 }
test_Uploadtree2PathStr()
test for Uploadtree2PathStr