Best Atoum code snippet using path.testGetRealPath
mainTest.php
Source:mainTest.php
1<?php2/**3 * test for tomk79\filesystem4 */5require_once( __DIR__.'/../php/filesystem.php' );6class mainTest extends PHPUnit_Framework_TestCase{7 private $fs;8 public function setup(){9 mb_internal_encoding('UTF-8');10 $conf = new stdClass;11 if( DIRECTORY_SEPARATOR == '\\' ){12 $conf->filesystem_encoding = "Shift_JIS";13 }14 $this->fs = new tomk79\filesystem($conf);15 }16 // ----------------------------------------------------------------------------17 // ã¦ã¼ãã£ãªãã£ã®ãã¹ã18 /**19 * ãã¹è¡¨ç¾ã®æ£è¦åã®ãã¹ã20 */21 public function testNormalizePath(){22 $this->assertEquals(23 $this->fs->get_realpath('/'),24 realpath('/')25 );26 $this->assertEquals(27 $this->fs->normalize_path('.\\aaa\\bbb.html'),28 './aaa/bbb.html'29 );30 $this->assertEquals(31 $this->fs->normalize_path('.\\aaa/bbb.html'),32 './aaa/bbb.html'33 );34 $this->assertEquals(35 $this->fs->normalize_path('.\\aaa///bbb.html'),36 './aaa/bbb.html'37 );38 $this->assertEquals(39 $this->fs->normalize_path('//www.example.com//aaa//bbb.html'),40 '//www.example.com/aaa/bbb.html'41 );42 $this->assertEquals(43 $this->fs->normalize_path('\\\\www.example.com/\\aaa\\/bbb.html'),44 '//www.example.com/aaa/bbb.html'45 );46 $this->assertEquals(47 $this->fs->normalize_path('https://www.example.com/\\/aaa/\\bbb/'),48 'https://www.example.com/aaa/bbb/'49 );50 $this->assertEquals(51 $this->fs->normalize_path('https:\\\\www.example.com/\\/aaa/\\bbb.html'),52 'https://www.example.com/aaa/bbb.html'53 );54 $this->assertEquals(55 $this->fs->normalize_path('C:\\test\\windows\\path\\'),56 '/test/windows/path/'57 );58 $this->assertEquals(59 $this->fs->normalize_path(' C:\\test\\windows\\path\\ '),//åå¾ã®ã¹ãã¼ã¹ã¯è©°ãããã¾ã60 '/test/windows/path/'61 );62 }63 /**64 * 絶対ãã¹è§£æ±ºã®ãã¹ã65 */66 public function testGetRealpath(){67 $this->assertEquals(68 $this->fs->get_realpath('/'),69 realpath('/')70 );71 $this->assertEquals(72 $this->fs->get_realpath('./mktest/aaa.txt'),73 $this->fs->localize_path(realpath('.').'/mktest/aaa.txt')74 );75 $this->assertEquals(76 $this->fs->get_realpath('./mktest/./aaa.txt', __DIR__),77 $this->fs->localize_path(__DIR__.'/mktest/aaa.txt')78 );79 $this->assertEquals(80 $this->fs->get_realpath(__DIR__.'/./mktest/../aaa.txt'),81 $this->fs->localize_path(__DIR__.'/aaa.txt')82 );83 $this->assertEquals(84 $this->fs->get_realpath('C:\\mktest\\aaa.txt'),85 $this->fs->localize_path('C:/mktest/aaa.txt')86 );87 $this->assertEquals(88 $this->fs->get_realpath('\\\\mktest\\aaa.txt'),89 $this->fs->localize_path('//mktest/aaa.txt')90 );91 $this->assertEquals(92 $this->fs->get_realpath('../../../mktest/aaa.txt','/aaa/'),93 $this->fs->localize_path('/mktest/aaa.txt')94 );95 $this->assertEquals(96 $this->fs->get_realpath('/mktest/','/aaa/'),97 DIRECTORY_SEPARATOR.'mktest'.DIRECTORY_SEPARATOR98 );99 }100 /**101 * ç¸å¯¾ãã¹è§£æ±ºã®ãã¹ã102 */103 public function testGetRelatedpath(){104 $this->assertEquals(105 $this->fs->get_relatedpath('/reltest/aaa.txt', '/'),106 $this->fs->localize_path( './reltest/aaa.txt' )107 );108 $this->assertEquals(109 $this->fs->get_relatedpath('/reltest/aaa.txt', '/reltest/'),110 $this->fs->localize_path( './aaa.txt' )111 );112 $this->assertEquals(113 $this->fs->get_relatedpath('/reltest/aaa.txt', '/reltest/reltest2/'),114 $this->fs->localize_path( '../aaa.txt' )115 );116 $this->assertEquals(117 $this->fs->get_relatedpath('/reltest/aaa.txt', '/reltest/reltest2/reltest3/'),118 '..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'aaa.txt'119 );120 $this->assertEquals(121 $this->fs->get_relatedpath('/reltest/./aaa.txt', '/reltest/reltest2/reltest3/'),122 '..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'aaa.txt'123 );124 $this->assertEquals(125 $this->fs->get_relatedpath('/reltest/./aaa.txt', '/reltest/reltest2/reltest3'),126 '..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'aaa.txt'127 );128 $this->assertEquals(129 $this->fs->get_relatedpath('/reltest/../reltest/aaa.txt', '/reltest/reltest2/reltest3'),130 '..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'aaa.txt'131 );132 $this->assertEquals(133 $this->fs->get_relatedpath('../../reltest2/../aaa.txt', '\\reltest\\reltest2\\reltest3'),134 '..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'aaa.txt'135 );136 }137 /**138 * ãã¡ã¤ã«ãªã¹ãåå¾ã®ãã¹ã139 */140 public function testLs(){141 $ls = $this->fs->ls( __DIR__ );142 $this->assertEquals( count($ls), 3 );143 // âè¿å´å¤ã¯ strnatcmpé (ABCé ) ã§ã½ã¼ãããã¦ããã¯ãã144 $i = 0;145 $this->assertEquals( $ls[$i++], 'data' );146 $this->assertEquals( $ls[$i++], 'mainTest.php' );147 $this->assertEquals( $ls[$i++], 'mktest' );148 $this->assertFalse( array_search('.', $ls) );149 $this->assertFalse( array_search('..', $ls) );150 }151 /**152 * æååå¤æã®ãã¹ã153 */154 public function testTextConvert(){155 // æ¹è¡ã³ã¼ã156 $this->assertEquals(157 $this->fs->convert_crlf('aa'."\r".'bb'."\r\n"),158 'aa'."\n".'bb'."\n"159 );160 $this->assertEquals(161 $this->fs->convert_crlf('aa'."\r".'bb'."\r\n", 'LF'),162 'aa'."\n".'bb'."\n"163 );164 $this->assertEquals(165 $this->fs->convert_crlf('aa'."\r".'bb'."\r\n", 'lf'),166 'aa'."\n".'bb'."\n"167 );168 $this->assertEquals(169 $this->fs->convert_crlf('aa'."\r".'bb'."\r\n", 'crlf'),170 'aa'."\r\n".'bb'."\r\n"171 );172 // æåã³ã¼ã173 $sample = mb_convert_encoding( 'æ¥æ¬èªã®æåå(UTF-8)', 'UTF-8', mb_internal_encoding() );174 $this->assertNotEquals(175 mb_convert_encoding($sample, 'SJIS-win', mb_internal_encoding()),176 $sample177 );178 $this->assertEquals(179 $this->fs->convert_encoding(180 $this->fs->convert_encoding($sample, 'SJIS-win'),181 'UTF-8'182 ),183 $sample184 );185 }186 /**187 * ãã¡ã¤ã«ã®æ´æ°æ¥æãæ¯è¼ãããã¹ã188 */189 public function testIsNewerAThanB(){190 touch(__DIR__.'/data/timestamp/file_new.txt');191 $this->assertTrue( $this->fs->is_newer_a_than_b(192 __DIR__.'/data/timestamp/file_new.txt',193 __DIR__.'/data/timestamp/file_old.txt'194 ) );195 $this->assertFalse( $this->fs->is_newer_a_than_b(196 __DIR__.'/data/timestamp/file_old.txt',197 __DIR__.'/data/timestamp/file_new.txt'198 ) );199 // åå¨ããªããã¡ã¤ã«ãæ¯è¼ããå ´å200 $this->assertFalse( $this->fs->is_newer_a_than_b(201 __DIR__.'/data/timestamp/file_not_exists.txt',202 __DIR__.'/data/timestamp/file_new.txt'203 ) );204 $this->assertTrue( $this->fs->is_newer_a_than_b(205 __DIR__.'/data/timestamp/file_new.txt',206 __DIR__.'/data/timestamp/file_not_exists.txt'207 ) );208 $this->assertNull( $this->fs->is_newer_a_than_b(209 __DIR__.'/data/timestamp/file_not_exists.txt',210 __DIR__.'/data/timestamp/file_not_exists.txt'211 ) );212 }213 // ----------------------------------------------------------------------------214 // ãã£ã¬ã¯ããªæä½ã®ãã¹ã215 /**216 * dataProvidor: ãã£ã¬ã¯ããªä¸è¦§217 */218 public function directoryProvider(){219 return array(220 array( __DIR__.'/mktest/testDirectory/' , 'testDirR/', 'filename.txt') ,221 array( __DIR__.'/mktest/ãã¹ããã£ã¬ã¯ããª/' , 'testDirR/', 'filename.txt') ,222 array( __DIR__.'/mktest\\testDirectoryWin\\' , 'testDirR/', 'filename.txt') ,223 );224 }225 /**226 * ãã£ã¬ã¯ããªä½æã®ãã¹ã(åé層)227 * @depends testGetRealpath228 * @depends testLs229 * @dataProvider directoryProvider230 */231 public function testMkDir( $path, $sub_dir, $filename ){232 // ãã£ã¬ã¯ããªãä½æ233 clearstatcache();234 $this->assertTrue( $this->fs->mkdir( $path ) );235 // ãã£ã¬ã¯ããªã®åå¨ç¢ºèª(åå¨ããã¹ã)236 clearstatcache();237 $this->assertTrue( $this->fs->is_dir($path) );238 }239 /**240 * ãã£ã¬ã¯ããªåé¤ã®ãã¹ã(åé層)241 * @depends testGetRealpath242 * @depends testLs243 * @depends testMkDir244 * @dataProvider directoryProvider245 */246 public function testRmDir( $path, $sub_dir, $filename ){247 // ãã£ã¬ã¯ããªã®åå¨ç¢ºèª(åå¨ããã¹ã)248 clearstatcache();249 $this->assertTrue( $this->fs->is_dir($path) );250 // ãã£ã¬ã¯ããªã®åé¤251 clearstatcache();252 $this->assertTrue( $this->fs->rmdir( $path ) );253 // ãã£ã¬ã¯ããªã®åå¨ç¢ºèª(åå¨ããªãã¹ã)254 clearstatcache();255 $this->assertFalse( $this->fs->is_dir($path) );256 }257 /**258 * ãã£ã¬ã¯ããªä½æã®ãã¹ã(å¤é層)259 * @depends testGetRealpath260 * @depends testLs261 * @dataProvider directoryProvider262 */263 public function testMkDirR( $path, $sub_dir, $filename ){264 // ãã£ã¬ã¯ããªãä½æ(ããã¯å¤±æãã)265 clearstatcache();266 $this->assertFalse( $this->fs->mkdir( $path.$sub_dir ) );267 // ãã£ã¬ã¯ããªã®åå¨ç¢ºèª(åå¨ããªãã¹ã)268 clearstatcache();269 $this->assertFalse( $this->fs->is_dir($path.$sub_dir) );270 // ãã£ã¬ã¯ããªãä½æ(Rãã¤ããã¨æåãã)271 clearstatcache();272 $this->assertTrue( $this->fs->mkdir_r( $path.$sub_dir ) );273 $this->assertTrue( $this->fs->save_file( $path.$sub_dir.$filename, 'testContent' ) );274 // ãã£ã¬ã¯ããªã®åå¨ç¢ºèª(åå¨ããã¹ã)275 clearstatcache();276 $this->assertTrue( $this->fs->is_dir($path) );277 $this->assertTrue( $this->fs->is_dir($path.$sub_dir) );278 $this->assertTrue( $this->fs->is_file($path.$sub_dir.$filename) );279 }280 /**281 * ãã£ã¬ã¯ããªåé¤ã®ãã¹ã(å¤é層)282 * @depends testGetRealpath283 * @depends testLs284 * @depends testMkDirR285 * @dataProvider directoryProvider286 */287 public function testRmDirR( $path, $sub_dir, $filename ){288 // ãã£ã¬ã¯ããªã®åå¨ç¢ºèª(åå¨ããã¹ã)289 clearstatcache();290 $this->assertTrue( $this->fs->is_dir($path.$sub_dir) );291 // ãã£ã¬ã¯ããªã®åé¤(ä¸ã空ãããªãã®ã§å¤±æãã)292 clearstatcache();293 $this->assertFalse( $this->fs->rmdir( $path ) );294 // ãã£ã¬ã¯ããªã®åé¤(å帰çã«åé¤ããã®ã§æåãã)295 clearstatcache();296 $this->assertTrue( $this->fs->rmdir_r( $path ) );297 // ãã£ã¬ã¯ããªã®åå¨ç¢ºèª(åå¨ããªãã¹ã)298 clearstatcache();299 $this->assertFalse( $this->fs->is_dir($path) );300 }301 // ----------------------------------------------------------------------------302 // ãã¡ã¤ã«æä½ã®ãã¹ã303 /**304 * dataProvidor: ãã¡ã¤ã«ãã¼ã¿305 */306 public function fileProvider(){307 return array(308 array( __DIR__.'/mktest/testfile.txt', 'test test' ) ,309 );310 }311 /**312 * ãã¡ã¤ã«åæä½ã®ãã¹ã313 * @depends testGetRealpath314 * @depends testLs315 */316 public function testProcFileName( $path, $content ){317 // ãã¹æ
å ±ãåå¾ãã318 $this->assertEquals( $this->fs->pathinfo( '/test.files/aaa/test.html.md?a=b&?c=d#test#.anch' ), array(319 'dirname' => '/test.files/aaa',320 'basename' => 'test.html.md',321 'extension' => 'md',322 'filename' => 'test.html',323 'query' => '?a=b&?c=d',324 'hash' => '#test#.anch',325 ) );326 $this->assertEquals( $this->fs->pathinfo( './test.files/aaa/test.html.MD?a=b&c=d#test.anch' ), array(327 'dirname' => './test.files/aaa',328 'basename' => 'test.html.MD',329 'extension' => 'MD',330 'filename' => 'test.html',331 'query' => '?a=b&c=d',332 'hash' => '#test.anch',333 ) );334 $this->assertEquals( $this->fs->pathinfo( './test.files/aaa/test' ), array(335 'dirname' => './test.files/aaa',336 'basename' => 'test',337 'extension' => null,338 'filename' => 'test',339 'query' => null,340 'hash' => null,341 ) );342 // ãã¡ã¤ã«åãåå¾ãã343 $this->assertEquals( $this->fs->get_basename( './aaa/test.html' ), 'test.html' );344 $this->assertEquals( $this->fs->get_basename( './aaa' ), 'aaa' );345 $this->assertEquals( $this->fs->get_basename( 'aaa' ), 'aaa' );346 $this->assertEquals( $this->fs->get_basename( './aaa/' ), 'aaa' );347 // ãã£ã¬ã¯ããªåãåå¾ãã348 $this->assertEquals( $this->fs->get_dirpath( './aaa/test.html' ), './aaa' );349 $this->assertEquals( $this->fs->get_dirpath( './aaa/test/' ), './aaa' );350 // æ¡å¼µåãåé¤ãã351 $this->assertEquals( $this->fs->trim_extension( './aaa/test.html' ), './aaa/test' );352 $this->assertEquals( $this->fs->trim_extension( './aaa/test.html.md' ), './aaa/test.html' );353 $this->assertEquals( $this->fs->trim_extension( './aaa/test' ), './aaa/test' );354 // æ¡å¼µåãåå¾ãã355 $this->assertEquals( $this->fs->get_extension( './aaa/test.html' ), 'html' );356 $this->assertEquals( $this->fs->get_extension( './aaa/test.html.MD' ), 'MD' );357 $this->assertNull( $this->fs->get_extension( './aaa/test' ) );358 }359 /**360 * ãã¡ã¤ã«ä½æã®ãã¹ã361 * @depends testGetRealpath362 * @depends testLs363 * @dataProvider fileProvider364 */365 public function testSaveFile( $path, $content ){366 // ãã¡ã¤ã«ãã¹ã®ãã¼ããã·ã§ã³ç¢ºèª367 clearstatcache();368 $this->assertTrue( $this->fs->is_writable( $path ) );369 // ãã¡ã¤ã«ãä½æ370 clearstatcache();371 $this->assertTrue( $this->fs->save_file( $path, $content ) );372 // ãã¡ã¤ã«ã®åå¨ç¢ºèª(åå¨ããã¹ã)373 clearstatcache();374 $this->assertTrue( $this->fs->is_file( $path ) );375 // ãã¡ã¤ã«ãèªã¿è¾¼ãã§ãå
容ã確èª376 clearstatcache();377 $this->assertEquals( $this->fs->read_file( $path ), $content );378 }379 /**380 * ãã¡ã¤ã«åé¤ã®ãã¹ã381 * @depends testGetRealpath382 * @depends testLs383 * @depends testSaveFile384 * @dataProvider fileProvider385 */386 public function testRmFile( $path, $content ){387 // ãã¡ã¤ã«ãã¹ã®ãã¼ããã·ã§ã³ç¢ºèª388 clearstatcache();389 $this->assertTrue( $this->fs->is_writable( $path ) );390 // ãã¡ã¤ã«ãåé¤391 clearstatcache();392 $this->assertTrue( $this->fs->rm( $path ) );393 // ãã¡ã¤ã«ã®åå¨ç¢ºèª(åå¨ããªãã¹ã)394 clearstatcache();395 $this->assertFalse( $this->fs->is_file( $path ) );396 }397 /**398 * ãã¡ã¤ã«ç§»åã®ãã¹ã399 * @depends testGetRealpath400 * @depends testLs401 * @depends testSaveFile402 * @depends testRmFile403 * @dataProvider renameProvider404 */405 public function testRename( $path_1, $path_2 ){406 // ãã¡ã¤ã«ãä½æ407 clearstatcache();408 $this->assertTrue( $this->fs->save_file( $path_1, 'rename_test...' ) );409 // ãã¡ã¤ã«ã®åå¨ç¢ºèª(åå¨ããã¹ã)410 clearstatcache();411 $this->assertTrue( $this->fs->is_file( $path_1 ) );412 // ãã¡ã¤ã«ã移å413 clearstatcache();414 $this->assertTrue( $this->fs->rename( $path_1, $path_2 ) );415 // ãã¡ã¤ã«ã®åå¨ç¢ºèª(1ã¯ãªãã¦ã2ã¯ããã¹ã)416 clearstatcache();417 $this->assertFalse( $this->fs->is_file( $path_1 ) );418 $this->assertTrue( $this->fs->is_file( $path_2 ) );419 // ãã¡ã¤ã«ãåé¤420 clearstatcache();421 $this->assertTrue( $this->fs->rm( $path_2 ) );422 // ãã¡ã¤ã«ã®åå¨ç¢ºèª(åå¨ããªãã¹ã)423 clearstatcache();424 $this->assertFalse( $this->fs->is_file( $path_2 ) );425 }426 public function renameProvider(){427 return array(428 array( __DIR__.'/mktest/test_1.txt', __DIR__.'/mktest/test_2.txt' ) ,429 array( __DIR__.'/mktest/ãã¹ã1.txt', __DIR__.'/mktest/ãã¹ã2.txt' ) ,430 );431 }432 /**433 * æ·±ããã¡ã¤ã«ç§»åã®ãã¹ã434 * @depends testGetRealpath435 * @depends testLs436 * @depends testSaveFile437 * @depends testRmFile438 * @depends testRmDirR439 * @depends testRename440 */441 public function testRenameR(){442 $this->fs->mkdir( __DIR__.'/mktest/testdir1/' );443 $this->fs->save_file( __DIR__.'/mktest/testdir1/test1.txt', 'rename_test...' );444 // ãã¡ã¤ã«ã¨ãã£ã¬ã¯ããªã®åå¨ç¢ºèª(åå¨ããã¹ã)445 clearstatcache();446 $this->assertTrue( $this->fs->is_dir( __DIR__.'/mktest/testdir1/' ) );447 $this->assertTrue( $this->fs->is_file( __DIR__.'/mktest/testdir1/test1.txt' ) );448 // ãã£ã¬ã¯ããªã移å449 clearstatcache();450 $this->assertTrue( $this->fs->rename_f( __DIR__.'/mktest/testdir1/', __DIR__.'/mktest/testdir2/deep3/testdir1/' ) );451 // ãã¡ã¤ã«ã®åå¨ç¢ºèª(1ã¯ãªãã¦ã2ã¯ããã¹ã)452 clearstatcache();453 $this->assertFalse( $this->fs->is_dir( __DIR__.'/mktest/testdir1/' ) );454 $this->assertFalse( $this->fs->is_file( __DIR__.'/mktest/testdir1/test1.txt' ) );455 clearstatcache();456 $this->assertTrue( $this->fs->is_file( __DIR__.'/mktest/testdir2/deep3/testdir1/test1.txt' ) );457 // ãã¡ã¤ã«ãåé¤458 clearstatcache();459 $this->assertTrue( $this->fs->rm( __DIR__.'/mktest/testdir2/' ) );460 // ãã¡ã¤ã«ã®åå¨ç¢ºèª(åå¨ããªãã¹ã)461 clearstatcache();462 $this->assertFalse( $this->fs->is_file( __DIR__.'/mktest/testdir2/' ) );463 }464 // ----------------------------------------------------------------------------465 // CSVãã¡ã¤ã«æä½ã®ãã¹ã466 /**467 * CSVãã¡ã¤ã«èªã¿è¾¼ã¿ã®ãã¹ã468 * @depends testGetRealpath469 * @depends testLs470 */471 public function testReadCsv(){472 // èªã¿è¾¼ããã¹ã473 $csvPath = __DIR__.'/data/test01.csv';474 clearstatcache();475 $this->assertTrue( $this->fs->is_file( $csvPath ) );476 $csv01 = $this->fs->read_csv( $csvPath );477 $this->assertEquals( gettype($csv01), gettype(array()) );478 $this->assertCount( 11, $csv01 );479 $this->assertCount( 4, $csv01[0] );480 $this->assertCount( 3, $csv01[1] );481 $this->assertEquals( $csv01[1][1], 'te,st' );482 $this->assertEquals( $csv01[2][0], 'te"st' );483 $this->assertEquals( $csv01[7][1], 'æ¥æ¬èª1-2' );484 $this->assertEquals( $csv01[8][1], 'æ¥æ¬èª2-2' );485 $this->assertEquals(486 $this->fs->convert_crlf($csv01[10][0]),487 $this->fs->convert_crlf('ãã®ã»ã«ã¯ãæ¹è¡ãå«ã¿ã¾ãã'."\n\n".'ããã¾ã§ã§1ã¤ã®ã»ã«ã§ãã')488 );489 }490 /**491 * CSVå½¢å¼ã®ãã¼ã¿ãä½æãããã¹ã492 */493 public function testMkCsv(){494 $this->assertEquals(495 $this->fs->mk_csv(496 array(497 array('a','b','c'),498 array('d','e','f'),499 )500 ),501 '"a","b","c"'."\n".'"d","e","f"'."\n"502 );503 $this->assertEquals(504 $this->fs->mk_csv(505 array(506 array('a','b,c'),507 array('d','e"e','f'),508 )509 ),510 '"a","b,c"'."\n".'"d","e""e","f"'."\n"511 );512 $this->assertEquals(513 $this->fs->mk_csv(514 array(515 array('a','æ¥æ¬èªãå«ãCSVå½¢å¼'),516 array('d','æ¥æ¬èªãå«ãCSVå½¢å¼','f'),517 )518 ),519 '"a","æ¥æ¬èªãå«ãCSVå½¢å¼"'."\n".'"d","æ¥æ¬èªãå«ãCSVå½¢å¼","f"'."\n"520 );521 }522 // ----------------------------------------------------------------------------523 // ãã®ä»ã®ãã¹ã524 /**525 * æ¡å¼µåãæ½åºãããã¹ã526 */527 public function testGetExtension(){528 $this->assertEquals(529 $this->fs->get_extension('./test.html'),530 'html'531 );532 $this->assertEquals(533 $this->fs->get_extension('./test.html?abc'),534 'html'535 );536 $this->assertEquals(537 $this->fs->get_extension('./test.html#abc'),538 'html'539 );540 $this->assertEquals(541 $this->fs->get_extension('./test.html?abc#abc'),542 'html'543 );544 $this->assertEquals(545 $this->fs->get_extension('./test.html.md'),546 'md'547 );548 $this->assertEquals(549 $this->fs->get_extension('./test.HtMl'),550 'HtMl'551 );552 $this->assertEquals(553 $this->fs->get_extension('./test.longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongextension'),554 'longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongextension'555 );556 }557}...
testGetRealPath
Using AI Code Generation
1$path = new path();2echo $path->testGetRealPath();3$path = new path();4echo $path->testGetRealPath();5$path = new path();6echo $path->testGetRealPath();7$path = new path();8echo $path->testGetRealPath();9$path = new path();10echo $path->testGetRealPath();11$path = new path();12echo $path->testGetRealPath();13$path = new path();14echo $path->testGetRealPath();15$path = new path();16echo $path->testGetRealPath();17$path = new path();18echo $path->testGetRealPath();19$path = new path();20echo $path->testGetRealPath();21$path = new path();22echo $path->testGetRealPath();23$path = new path();24echo $path->testGetRealPath();25$path = new path();26echo $path->testGetRealPath();27$path = new path();28echo $path->testGetRealPath();29$path = new path();30echo $path->testGetRealPath();
testGetRealPath
Using AI Code Generation
1require_once 'path.php';2$path = new path();3echo $path->testGetRealPath('1.php');4require_once 'path.php';5$path = new path();6echo $path->testGetRealPath('2.php');7require_once 'path.php';8$path = new path();9echo $path->testGetRealPath('3.php');10require_once 'path.php';11$path = new path();12echo $path->testGetRealPath('4.php');13require_once 'path.php';14$path = new path();15echo $path->testGetRealPath('5.php');16require_once 'path.php';17$path = new path();18echo $path->testGetRealPath('6.php');19require_once 'path.php';20$path = new path();21echo $path->testGetRealPath('7.php');22require_once 'path.php';23$path = new path();24echo $path->testGetRealPath('8.php');25require_once 'path.php';26$path = new path();27echo $path->testGetRealPath('9.php');28require_once 'path.php';29$path = new path();30echo $path->testGetRealPath('10.php');31require_once 'path.php';32$path = new path();33echo $path->testGetRealPath('11.php');34require_once 'path.php';35$path = new path();36echo $path->testGetRealPath('12.php');
testGetRealPath
Using AI Code Generation
1require_once 'path.php';2$path = new Path();3echo $path->testGetRealPath("1.php");4require_once 'path.php';5$path = new Path();6echo $path->testGetRealPath("2.php");7class Path {8 public function testGetRealPath($path) {9 return realpath($path);10 }11}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with testGetRealPath on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!