FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
ui-picker-Test.php
1 <?php
2 /*
3 Copyright (C) 2011 Hewlett-Packard Development Company, L.P.
4 Copyright (C) 2014, Siemens AG
5 
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 version 2 as published by the Free Software Foundation.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19 
20 use Mockery as M;
21 
22 $wwwPath = dirname(dirname(__DIR__));
23 global $container;
24 $container = M::mock('ContainerBuilder');
25 $container->shouldReceive('get');
26 require_once(dirname($wwwPath).'/lib/php/Plugin/FO_Plugin.php');
27 if(!function_exists('register_plugin')){ function register_plugin(){}}
28 require_once ($wwwPath.'/ui/ui-picker.php');
29 
30 class ui_picker_Test extends \PHPUnit\Framework\TestCase
31 {
35  public function test_Uploadtree2PathStr (){
36  global $container;
37  $container = M::mock('ContainerBuilder');
38  $container->shouldReceive('get');
39  $uiPicker = new ui_picker();
40 
41  $reflection = new \ReflectionClass( get_class($uiPicker) );
42  $method = $reflection->getMethod('Uploadtree2PathStr');
43  $method->setAccessible(true);
44 
45  $result = $method->invoke($uiPicker,array(array('ufile_name'=>'path'),array('ufile_name'=>'to'),array('ufile_name'=>'nowhere')));
46  assertThat($result, is('/path/to/nowhere'));
47  }
48 
49 }
test_Uploadtree2PathStr()
test for Uploadtree2PathStr