copydir($src . $DS . $file, $dst . $DS . $file); } else { copy($src . $DS . $file, $dst . $DS . $file); } } } closedir($dir); } /* public function testMenuSelector() { } */ public function testGetLayouts() { $src1 = codecept_data_dir()."testcore"; $dest1 = e_THEME."testcore"; $this->copydir($src1,$dest1); $src2 = codecept_data_dir()."testkubrick"; $dest2 = e_THEME."testkubrick"; $this->copydir($src2,$dest2); $tests = array( 'bootstrap3' => array ( 'templates' => array( // template key and string length 'jumbotron_home' => 2940, 'modern_business_home' => 3746, 'jumbotron_full' => 1949, 'jumbotron_sidebar_right' => 2765 ), 'menus' => array ( 'jumbotron_home' => array ('1','2','3','4','5','6','7','8','9','10','11','12','13','14','100','101','102','103','104','105','106','107',), 'modern_business_home' => array ('10','100','101','102','103','104','105','106','107',), 'jumbotron_full' => array ('1','100','101','102','103','104','105','106','107',), 'jumbotron_sidebar_right' => array ('1','2','3','4','5','6','7','8','100','101','102','103','104','105','106','107',), ), ), 'testkubrick' => array ( 'templates' => array( 'legacyCustom' => 283, 'legacyDefault' => 328 ), 'menus' => array( 'legacyCustom' => array(), 'legacyDefault' => array('1', '2') ), ), 'testcore' => array ( 'templates' => array ( 'HOME' => 1635, 'FULL' => 1378, 'legacyDefault'=> 1807 ), 'menus' => array( 'HOME' => array('2', '3', '4'), 'FULL' => array(), 'legacyDefault'=> array('1', '2', '3', '4','5','6') ), ) ); foreach($tests as $theme=>$vars) { $result = e_menu_layout::getLayouts($theme); // var_dump($result['templates']); // var_export($result['menus']); foreach($vars['templates'] as $key=>$length) { $expectedLength = $length; $actualLength = strlen($result['templates'][$key]); $this->assertEquals($expectedLength, $actualLength); } foreach($vars['menus'] as $key=>$arr) { $this->assertEquals($arr, $result['menus'][$key]); } } } }