@@ -13,19 +13,19 @@ |
||
| 13 | 13 | |
| 14 | 14 | class I18N_core_AllTests { |
| 15 | 15 | public static function main() { |
| 16 | - PHPUnit_TextUI_TestRunner::run(self::suite()); |
|
| 16 | + PHPUnit_TextUI_TestRunner::run(self::suite()); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public static function suite() { |
| 20 | - $suite = new PHPUnit_Framework_TestSuite('System.I18N.core'); |
|
| 20 | + $suite = new PHPUnit_Framework_TestSuite('System.I18N.core'); |
|
| 21 | 21 | |
| 22 | - $suite->addTestSuite('CultureInfoTest'); |
|
| 22 | + $suite->addTestSuite('CultureInfoTest'); |
|
| 23 | 23 | $suite->addTestSuite('DateFormatTest'); |
| 24 | 24 | $suite->addTestSuite('DateTimeFormatInfoTest'); |
| 25 | 25 | $suite->addTestSuite('NumberFormatInfoTest'); |
| 26 | 26 | $suite->addTestSuite('NumberFormatTest'); |
| 27 | 27 | |
| 28 | - return $suite; |
|
| 28 | + return $suite; |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
@@ -9,16 +9,16 @@ |
||
| 9 | 9 | |
| 10 | 10 | class Util_AllTests { |
| 11 | 11 | public static function main() { |
| 12 | - PHPUnit_TextUI_TestRunner::run(self::suite()); |
|
| 12 | + PHPUnit_TextUI_TestRunner::run(self::suite()); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | public static function suite() { |
| 16 | - $suite = new PHPUnit_Framework_TestSuite('System.Util'); |
|
| 16 | + $suite = new PHPUnit_Framework_TestSuite('System.Util'); |
|
| 17 | 17 | |
| 18 | 18 | $suite->addTestSuite('TDateTimeStampTest'); |
| 19 | 19 | $suite->addTestSuite('TLoggerTest'); |
| 20 | 20 | |
| 21 | - return $suite; |
|
| 21 | + return $suite; |
|
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
@@ -10,17 +10,17 @@ |
||
| 10 | 10 | |
| 11 | 11 | class Caching_AllTests { |
| 12 | 12 | public static function main() { |
| 13 | - PHPUnit_TextUI_TestRunner::run(self::suite()); |
|
| 13 | + PHPUnit_TextUI_TestRunner::run(self::suite()); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public static function suite() { |
| 17 | - $suite = new PHPUnit_Framework_TestSuite('System.Caching'); |
|
| 17 | + $suite = new PHPUnit_Framework_TestSuite('System.Caching'); |
|
| 18 | 18 | |
| 19 | 19 | $suite->addTestSuite('TSqliteCacheTest'); |
| 20 | 20 | $suite->addTestSuite('TAPCCacheTest'); |
| 21 | 21 | $suite->addTestSuite('TMemCacheTest'); |
| 22 | 22 | |
| 23 | - return $suite; |
|
| 23 | + return $suite; |
|
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | |
@@ -10,18 +10,18 @@ discard block |
||
| 10 | 10 | const URISTR='http://login:p@ssw0rd:[email protected]:80/demos/quickstart/index.php?page=test¶m1=test2#anchor'; |
| 11 | 11 | |
| 12 | 12 | public function setUp () { |
| 13 | - $this->uri=new TUri(self::URISTR); |
|
| 13 | + $this->uri=new TUri(self::URISTR); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function tearDown() { |
| 17 | - $this->uri=null; |
|
| 17 | + $this->uri=null; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function testConstruct() { |
| 21 | - $url="http://www.pradoframework.net/"; |
|
| 22 | - $uri=new TUri ($url); |
|
| 23 | - self::assertEquals($url, $uri->getUri() ); |
|
| 24 | - // Bad uri test |
|
| 21 | + $url="http://www.pradoframework.net/"; |
|
| 22 | + $uri=new TUri ($url); |
|
| 23 | + self::assertEquals($url, $uri->getUri() ); |
|
| 24 | + // Bad uri test |
|
| 25 | 25 | $url="http://www.pradoframework.net:badport/test"; |
| 26 | 26 | try { |
| 27 | 27 | $url=new TUri($url); |
@@ -32,38 +32,38 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public function testGetUri() { |
| 35 | - self::assertEquals(self::URISTR, $this->uri->getUri()); |
|
| 35 | + self::assertEquals(self::URISTR, $this->uri->getUri()); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function testGetScheme() { |
| 39 | - self::assertEquals('http', $this->uri->getScheme()); |
|
| 39 | + self::assertEquals('http', $this->uri->getScheme()); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function testGetHost() { |
| 43 | - self::assertEquals('www.pradoframework.net', $this->uri->getHost()); |
|
| 43 | + self::assertEquals('www.pradoframework.net', $this->uri->getHost()); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public function testGetPort() { |
| 47 | - self::assertEquals(80, $this->uri->getPort()); |
|
| 47 | + self::assertEquals(80, $this->uri->getPort()); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function testGetUser() { |
| 51 | - self::assertEquals('login', $this->uri->getUser()); |
|
| 51 | + self::assertEquals('login', $this->uri->getUser()); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function testGetPassword() { |
| 55 | - self::assertEquals('p@ssw0rd:compl3x', $this->uri->getPassword()); |
|
| 55 | + self::assertEquals('p@ssw0rd:compl3x', $this->uri->getPassword()); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public function testGetPath() { |
| 59 | - self::assertEquals('/demos/quickstart/index.php', $this->uri->getPath()); |
|
| 59 | + self::assertEquals('/demos/quickstart/index.php', $this->uri->getPath()); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public function testGetQuery() { |
| 63 | - self::assertEquals('page=test¶m1=test2', $this->uri->getQuery()); |
|
| 63 | + self::assertEquals('page=test¶m1=test2', $this->uri->getQuery()); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | public function testGetFragment() { |
| 67 | - self::assertEquals('anchor', $this->uri->getFragment()); |
|
| 67 | + self::assertEquals('anchor', $this->uri->getFragment()); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | \ No newline at end of file |
@@ -256,14 +256,14 @@ discard block |
||
| 256 | 256 | $acceptLanguages=array('fr', 'en-us','fr-fr','en'); |
| 257 | 257 | self::assertEquals($acceptLanguages, $request->getUserLanguages()); |
| 258 | 258 | */ |
| 259 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 259 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | public function testSetEnableCookieValidation() { |
| 263 | - $request = new THttpRequest(); |
|
| 264 | - $request->init(null); |
|
| 265 | - $request->setEnableCookieValidation (true); |
|
| 266 | - self::assertEquals(true, $request->getEnableCookieValidation()); |
|
| 263 | + $request = new THttpRequest(); |
|
| 264 | + $request->init(null); |
|
| 265 | + $request->setEnableCookieValidation (true); |
|
| 266 | + self::assertEquals(true, $request->getEnableCookieValidation()); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | public function testGetCookies() { |
@@ -288,25 +288,25 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | public function testGetUploadedFiles() { |
| 291 | - $request = new THttpRequest (); |
|
| 291 | + $request = new THttpRequest (); |
|
| 292 | 292 | $request->init (null); |
| 293 | 293 | self::assertEquals($_FILES, $request->getUploadedFiles()); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | public function testGetServerVariables() { |
| 297 | - $request = new THttpRequest (); |
|
| 297 | + $request = new THttpRequest (); |
|
| 298 | 298 | $request->init (null); |
| 299 | 299 | self::assertEquals($_SERVER, $request->getServerVariables()); |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | public function testGetEnvironmentVariables() { |
| 303 | - $request = new THttpRequest (); |
|
| 303 | + $request = new THttpRequest (); |
|
| 304 | 304 | $request->init (null); |
| 305 | 305 | self::assertEquals($_ENV, $request->getEnvironmentVariables()); |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | public function testConstructUrl() { |
| 309 | - $request = new THttpRequest (); |
|
| 309 | + $request = new THttpRequest (); |
|
| 310 | 310 | $request->init (null); |
| 311 | 311 | // Try to construct an url to the pageservice with some parameters |
| 312 | 312 | $url=$request->constructURL('page','Home',array('param1'=>'value1','param2'=>'value2'), true); |
@@ -314,57 +314,57 @@ discard block |
||
| 314 | 314 | // Try without encode & |
| 315 | 315 | $url=$request->constructURL('page','Home',array('param1'=>'value1','param2'=>'value2'), false); |
| 316 | 316 | self::assertEquals('/demos/personal/index.php?page=Home¶m1=value1¶m2=value2', $url); |
| 317 | - // Try to use HTTPS even if the current request is sent via HTTP |
|
| 318 | - //$url=$request->constructURL('page','Home',array('param1'=>'value1','param2'=>'value2'), false, false, true); |
|
| 319 | - //self::assertEquals('https', substr($url,0,5)); |
|
| 317 | + // Try to use HTTPS even if the current request is sent via HTTP |
|
| 318 | + //$url=$request->constructURL('page','Home',array('param1'=>'value1','param2'=>'value2'), false, false, true); |
|
| 319 | + //self::assertEquals('https', substr($url,0,5)); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | public function testSetServiceID() { |
| 323 | - $request = new THttpRequest (); |
|
| 324 | - $request->setServiceId('page'); |
|
| 325 | - self::assertEquals('page', $request->getServiceId()); |
|
| 323 | + $request = new THttpRequest (); |
|
| 324 | + $request->setServiceId('page'); |
|
| 325 | + self::assertEquals('page', $request->getServiceId()); |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | public function testGetIterator() { |
| 329 | - $request = new THttpRequest (); |
|
| 330 | - $request->init(null); |
|
| 331 | - self::assertInstanceOf ('TMapIterator', $request->getIterator()); |
|
| 329 | + $request = new THttpRequest (); |
|
| 330 | + $request->init(null); |
|
| 331 | + self::assertInstanceOf ('TMapIterator', $request->getIterator()); |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | public function testGetCount() { |
| 335 | - $request = new THttpRequest (); |
|
| 336 | - $request->init(null); |
|
| 337 | - // Simulate a request with just a service |
|
| 335 | + $request = new THttpRequest (); |
|
| 336 | + $request->init(null); |
|
| 337 | + // Simulate a request with just a service |
|
| 338 | 338 | $_GET['page']='Home'; |
| 339 | - $request->resolveRequest(array('page')); |
|
| 340 | - // Should return 1 (service param, and no get param) |
|
| 339 | + $request->resolveRequest(array('page')); |
|
| 340 | + // Should return 1 (service param, and no get param) |
|
| 341 | 341 | self::assertEquals(1, $request->getCount()); |
| 342 | 342 | self::assertEquals(1, $request->count()); |
| 343 | 343 | |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | public function testGetKeys() { |
| 347 | - $request = new THttpRequest (); |
|
| 348 | - $request->init(null); |
|
| 349 | - // Simulate a request with just a service |
|
| 347 | + $request = new THttpRequest (); |
|
| 348 | + $request->init(null); |
|
| 349 | + // Simulate a request with just a service |
|
| 350 | 350 | $_GET['page']='Home'; |
| 351 | - $request->resolveRequest(array('page')); |
|
| 351 | + $request->resolveRequest(array('page')); |
|
| 352 | 352 | self::assertEquals(array('page'), $request->getKeys()); |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | public function testItemAt() { |
| 356 | - $request = new THttpRequest (); |
|
| 357 | - $request->init(null); |
|
| 358 | - // Simulate a request with just a service |
|
| 356 | + $request = new THttpRequest (); |
|
| 357 | + $request->init(null); |
|
| 358 | + // Simulate a request with just a service |
|
| 359 | 359 | $_GET['page']='Home'; |
| 360 | - $request->resolveRequest(array('page')); |
|
| 360 | + $request->resolveRequest(array('page')); |
|
| 361 | 361 | self::assertEquals('Home', $request->itemAt('page')); |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | public function testAdd() { |
| 365 | - $request = new THttpRequest (); |
|
| 366 | - $request->init(null); |
|
| 367 | - // Simulate a request with just a service |
|
| 365 | + $request = new THttpRequest (); |
|
| 366 | + $request->init(null); |
|
| 367 | + // Simulate a request with just a service |
|
| 368 | 368 | $_GET['page']='Home'; |
| 369 | 369 | $request->resolveRequest(array('page')); |
| 370 | 370 | $request->Add('param1','value1'); |
@@ -372,9 +372,9 @@ discard block |
||
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | public function testRemove() { |
| 375 | - $request = new THttpRequest (); |
|
| 376 | - $request->init(null); |
|
| 377 | - // Simulate a request with just a service |
|
| 375 | + $request = new THttpRequest (); |
|
| 376 | + $request->init(null); |
|
| 377 | + // Simulate a request with just a service |
|
| 378 | 378 | $_GET['page']='Home'; |
| 379 | 379 | $request->resolveRequest(array('page')); |
| 380 | 380 | // Remove an unknow key |
@@ -384,9 +384,9 @@ discard block |
||
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | public function testContains() { |
| 387 | - $request = new THttpRequest (); |
|
| 388 | - $request->init(null); |
|
| 389 | - // Simulate a request with just a service |
|
| 387 | + $request = new THttpRequest (); |
|
| 388 | + $request->init(null); |
|
| 389 | + // Simulate a request with just a service |
|
| 390 | 390 | $_GET['page']='Home'; |
| 391 | 391 | $request->resolveRequest(array('page')); |
| 392 | 392 | self::assertTrue($request->contains('page')); |
@@ -395,8 +395,8 @@ discard block |
||
| 395 | 395 | |
| 396 | 396 | public function testClear() { |
| 397 | 397 | $request = new THttpRequest (); |
| 398 | - $request->init(null); |
|
| 399 | - // Simulate a request with just a service |
|
| 398 | + $request->init(null); |
|
| 399 | + // Simulate a request with just a service |
|
| 400 | 400 | $_GET['page']='Home'; |
| 401 | 401 | $request->resolveRequest(array('page')); |
| 402 | 402 | $request->clear(); |
@@ -404,45 +404,45 @@ discard block |
||
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | public function testToArray() { |
| 407 | - $request = new THttpRequest (); |
|
| 408 | - $request->init(null); |
|
| 409 | - // Simulate a request with just a service |
|
| 407 | + $request = new THttpRequest (); |
|
| 408 | + $request->init(null); |
|
| 409 | + // Simulate a request with just a service |
|
| 410 | 410 | $_GET['page']='Home'; |
| 411 | 411 | $request->resolveRequest(array('page')); |
| 412 | 412 | self::assertEquals(array ('page'=>'Home'), $request->toArray()); |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | public function testOffsetExists() { |
| 416 | - $request = new THttpRequest (); |
|
| 417 | - $request->init (null); |
|
| 418 | - // should not exists |
|
| 419 | - self::assertFalse($request->offsetExists(0)); |
|
| 416 | + $request = new THttpRequest (); |
|
| 417 | + $request->init (null); |
|
| 418 | + // should not exists |
|
| 419 | + self::assertFalse($request->offsetExists(0)); |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | public function testOffsetGet() { |
| 423 | - $request = new THttpRequest (); |
|
| 424 | - $request->init (null); |
|
| 425 | - // should not exists |
|
| 426 | - self::assertNull($request->offsetGet(0)); |
|
| 423 | + $request = new THttpRequest (); |
|
| 424 | + $request->init (null); |
|
| 425 | + // should not exists |
|
| 426 | + self::assertNull($request->offsetGet(0)); |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | public function testOffsetSet() { |
| 430 | - $request = new THttpRequest (); |
|
| 431 | - $request->init (null); |
|
| 432 | - $request->offsetSet(0, 'test'); |
|
| 433 | - // should not exists |
|
| 434 | - self::assertEquals('test',$request->offsetGet(0)); |
|
| 430 | + $request = new THttpRequest (); |
|
| 431 | + $request->init (null); |
|
| 432 | + $request->offsetSet(0, 'test'); |
|
| 433 | + // should not exists |
|
| 434 | + self::assertEquals('test',$request->offsetGet(0)); |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | public function testOffsetUnset() { |
| 438 | - $request = new THttpRequest (); |
|
| 439 | - $request->init (null); |
|
| 440 | - $request->offsetSet(0, 'test'); |
|
| 441 | - // Count should be 1 |
|
| 442 | - self::assertEquals (1, $request->count()); |
|
| 443 | - $request->offsetUnset(0); |
|
| 444 | - // Now, count should be zero |
|
| 445 | - self::assertEquals (0, $request->count()); |
|
| 438 | + $request = new THttpRequest (); |
|
| 439 | + $request->init (null); |
|
| 440 | + $request->offsetSet(0, 'test'); |
|
| 441 | + // Count should be 1 |
|
| 442 | + self::assertEquals (1, $request->count()); |
|
| 443 | + $request->offsetUnset(0); |
|
| 444 | + // Now, count should be zero |
|
| 445 | + self::assertEquals (0, $request->count()); |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | public function testGetSetID() { |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | if (self::$assetDir===null) self::$assetDir= dirname(__FILE__).'/assets'; |
| 35 | 35 | // Make asset directory if not exists |
| 36 | - if (!file_exists (self::$assetDir)) { |
|
| 37 | - if (is_writable(dirname(self::$assetDir))) |
|
| 38 | - mkdir (self::$assetDir) ; |
|
| 39 | - else |
|
| 40 | - throw new Exception ('Directory '.dirname(self::$assetDir).' is not writable'); |
|
| 41 | - } elseif (!is_dir (self::$assetDir)) { |
|
| 42 | - throw new Exception (self::$assetDir.' exists and is not a directory'); |
|
| 43 | - } |
|
| 36 | + if (!file_exists (self::$assetDir)) { |
|
| 37 | + if (is_writable(dirname(self::$assetDir))) |
|
| 38 | + mkdir (self::$assetDir) ; |
|
| 39 | + else |
|
| 40 | + throw new Exception ('Directory '.dirname(self::$assetDir).' is not writable'); |
|
| 41 | + } elseif (!is_dir (self::$assetDir)) { |
|
| 42 | + throw new Exception (self::$assetDir.' exists and is not a directory'); |
|
| 43 | + } |
|
| 44 | 44 | // Define an alias to asset directory |
| 45 | 45 | prado::setPathofAlias('AssetAlias', self::$assetDir); |
| 46 | 46 | |
@@ -50,22 +50,22 @@ discard block |
||
| 50 | 50 | // Let's be sure $dir is a directory to avoir any error. Clear the cache ! |
| 51 | 51 | clearstatcache(); |
| 52 | 52 | if (is_dir($dir)) { |
| 53 | - foreach (scandir($dir) as $content) { |
|
| 54 | - if ($content==='.' or $content==='..') continue; // skip . and .. |
|
| 55 | - $content=$dir.'/'.$content; |
|
| 56 | - if (is_dir($content)) |
|
| 57 | - $this->removeDirectory ($content); // Recursivly remove directories |
|
| 58 | - else |
|
| 59 | - unlink ($content); // Remove file |
|
| 60 | - } |
|
| 61 | - // Now, directory should be empty, remove it |
|
| 62 | - rmdir ($dir); |
|
| 53 | + foreach (scandir($dir) as $content) { |
|
| 54 | + if ($content==='.' or $content==='..') continue; // skip . and .. |
|
| 55 | + $content=$dir.'/'.$content; |
|
| 56 | + if (is_dir($content)) |
|
| 57 | + $this->removeDirectory ($content); // Recursivly remove directories |
|
| 58 | + else |
|
| 59 | + unlink ($content); // Remove file |
|
| 60 | + } |
|
| 61 | + // Now, directory should be empty, remove it |
|
| 62 | + rmdir ($dir); |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | public function tearDown () { |
| 67 | 67 | // Make some cleaning :) |
| 68 | - $this->removeDirectory(self::$assetDir); |
|
| 68 | + $this->removeDirectory(self::$assetDir); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | public function testInit() { |
@@ -126,27 +126,27 @@ discard block |
||
| 126 | 126 | $manager->init (null); |
| 127 | 127 | |
| 128 | 128 | // Try to publish a single file |
| 129 | - $fileToPublish=dirname(__FILE__).'/data/pradoheader.gif'; |
|
| 129 | + $fileToPublish=dirname(__FILE__).'/data/pradoheader.gif'; |
|
| 130 | 130 | $publishedUrl = $manager->publishFilePath($fileToPublish); |
| 131 | 131 | $publishedFile=self::$assetDir.$publishedUrl; |
| 132 | 132 | self::assertEquals($publishedFile, $manager->getPublishedPath($fileToPublish)); |
| 133 | 133 | self::assertEquals($publishedUrl, $manager->getPublishedUrl($fileToPublish)); |
| 134 | 134 | self::assertTrue(is_file($publishedFile)); |
| 135 | 135 | |
| 136 | - // try to publish invalid file |
|
| 137 | - try { |
|
| 138 | - $manager->publishFilePath('invalid_file'); |
|
| 139 | - self::fail('Expected TInvalidDataValueException not thrown'); |
|
| 140 | - } catch (TInvalidDataValueException $e) {} |
|
| 136 | + // try to publish invalid file |
|
| 137 | + try { |
|
| 138 | + $manager->publishFilePath('invalid_file'); |
|
| 139 | + self::fail('Expected TInvalidDataValueException not thrown'); |
|
| 140 | + } catch (TInvalidDataValueException $e) {} |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | public function testPublishFilePathWithDirectory () { |
| 144 | - $manager=new TAssetManager(); |
|
| 144 | + $manager=new TAssetManager(); |
|
| 145 | 145 | $manager->setBaseUrl('/'); |
| 146 | 146 | $manager->init (null); |
| 147 | 147 | |
| 148 | 148 | // Try to publish a directory |
| 149 | - $dirToPublish=dirname(__FILE__).'/data'; |
|
| 149 | + $dirToPublish=dirname(__FILE__).'/data'; |
|
| 150 | 150 | $publishedUrl = $manager->publishFilePath($dirToPublish); |
| 151 | 151 | $publishedDir=self::$assetDir.$publishedUrl; |
| 152 | 152 | self::assertEquals($publishedDir, $manager->getPublishedPath($dirToPublish)); |
@@ -165,17 +165,17 @@ discard block |
||
| 165 | 165 | $md5File=dirname(__FILE__).'/data/aTarFile.md5'; |
| 166 | 166 | |
| 167 | 167 | // First, try with bad md5 |
| 168 | - try { |
|
| 169 | - $manager->publishTarFile($tarFile, 'badMd5File'); |
|
| 170 | - self::fail('Expected TInvalidDataValueException not thrown'); |
|
| 171 | - } catch (TInvalidDataValueException $e) {} |
|
| 172 | - |
|
| 173 | - // Then, try with real md5 file |
|
| 174 | - $publishedUrl=$manager->publishTarFile($tarFile, $md5File); |
|
| 175 | - $publishedDir=self::$assetDir.$publishedUrl; |
|
| 176 | - self::assertTrue(is_dir($publishedDir)); |
|
| 177 | - self::assertTrue(is_file($publishedDir.'/pradoheader.gif')); |
|
| 178 | - self::assertTrue(is_file($publishedDir.'/aTarFile.md5')); |
|
| 168 | + try { |
|
| 169 | + $manager->publishTarFile($tarFile, 'badMd5File'); |
|
| 170 | + self::fail('Expected TInvalidDataValueException not thrown'); |
|
| 171 | + } catch (TInvalidDataValueException $e) {} |
|
| 172 | + |
|
| 173 | + // Then, try with real md5 file |
|
| 174 | + $publishedUrl=$manager->publishTarFile($tarFile, $md5File); |
|
| 175 | + $publishedDir=self::$assetDir.$publishedUrl; |
|
| 176 | + self::assertTrue(is_dir($publishedDir)); |
|
| 177 | + self::assertTrue(is_file($publishedDir.'/pradoheader.gif')); |
|
| 178 | + self::assertTrue(is_file($publishedDir.'/aTarFile.md5')); |
|
| 179 | 179 | |
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | \ No newline at end of file |
@@ -11,92 +11,92 @@ discard block |
||
| 11 | 11 | public static $app=null; |
| 12 | 12 | |
| 13 | 13 | public function setUp () { |
| 14 | - if (self::$app===null) self::$app=new TApplication(dirname(__FILE__).'/app'); |
|
| 15 | - ob_start(); |
|
| 14 | + if (self::$app===null) self::$app=new TApplication(dirname(__FILE__).'/app'); |
|
| 15 | + ob_start(); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function tearDown () { |
| 19 | - ob_end_flush(); |
|
| 19 | + ob_end_flush(); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function testInit() { |
| 23 | - $response=new THttpResponse (); |
|
| 24 | - $response->init (null); |
|
| 25 | - self::assertEquals ($response, self::$app->getResponse()); |
|
| 23 | + $response=new THttpResponse (); |
|
| 24 | + $response->init (null); |
|
| 25 | + self::assertEquals ($response, self::$app->getResponse()); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function testSetCacheExpire() { |
| 29 | - $response=new THttpResponse (); |
|
| 30 | - $response->init (null); |
|
| 31 | - $response->setCacheExpire (300); |
|
| 32 | - self::assertEquals(300, $response->getCacheExpire()); |
|
| 29 | + $response=new THttpResponse (); |
|
| 30 | + $response->init (null); |
|
| 31 | + $response->setCacheExpire (300); |
|
| 32 | + self::assertEquals(300, $response->getCacheExpire()); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function testSetCacheControl() { |
| 36 | - $response=new THttpResponse (); |
|
| 37 | - $response->init (null); |
|
| 38 | - foreach (array ('none','nocache','private','private_no_expire','public') as $cc) { |
|
| 39 | - $response->setCacheControl($cc); |
|
| 40 | - self::assertEquals($cc, $response->getCacheControl()); |
|
| 41 | - } |
|
| 42 | - try { |
|
| 43 | - $response->setCacheControl('invalid'); |
|
| 44 | - self::fail ('Expected TInvalidDataValueException not thrown'); |
|
| 45 | - } catch (TInvalidDataValueException $e) {} |
|
| 36 | + $response=new THttpResponse (); |
|
| 37 | + $response->init (null); |
|
| 38 | + foreach (array ('none','nocache','private','private_no_expire','public') as $cc) { |
|
| 39 | + $response->setCacheControl($cc); |
|
| 40 | + self::assertEquals($cc, $response->getCacheControl()); |
|
| 41 | + } |
|
| 42 | + try { |
|
| 43 | + $response->setCacheControl('invalid'); |
|
| 44 | + self::fail ('Expected TInvalidDataValueException not thrown'); |
|
| 45 | + } catch (TInvalidDataValueException $e) {} |
|
| 46 | 46 | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | public function testSetContentType() { |
| 50 | - $response=new THttpResponse (); |
|
| 51 | - $response->init (null); |
|
| 52 | - $response->setContentType('image/jpeg'); |
|
| 53 | - self::assertEquals('image/jpeg', $response->getContentType()); |
|
| 54 | - $response->setContentType('text/plain'); |
|
| 55 | - self::assertEquals('text/plain', $response->getContentType()); |
|
| 50 | + $response=new THttpResponse (); |
|
| 51 | + $response->init (null); |
|
| 52 | + $response->setContentType('image/jpeg'); |
|
| 53 | + self::assertEquals('image/jpeg', $response->getContentType()); |
|
| 54 | + $response->setContentType('text/plain'); |
|
| 55 | + self::assertEquals('text/plain', $response->getContentType()); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public function testSetCharset() { |
| 59 | - $response=new THttpResponse (); |
|
| 60 | - $response->init (null); |
|
| 61 | - $response->setCharset ('UTF-8'); |
|
| 62 | - self::assertEquals('UTF-8', $response->getCharset()); |
|
| 63 | - $response->setCharset ('ISO8859-1'); |
|
| 64 | - self::assertEquals('ISO8859-1', $response->getCharset()); |
|
| 59 | + $response=new THttpResponse (); |
|
| 60 | + $response->init (null); |
|
| 61 | + $response->setCharset ('UTF-8'); |
|
| 62 | + self::assertEquals('UTF-8', $response->getCharset()); |
|
| 63 | + $response->setCharset ('ISO8859-1'); |
|
| 64 | + self::assertEquals('ISO8859-1', $response->getCharset()); |
|
| 65 | 65 | |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | public function testSetBufferOutput() { |
| 69 | - $response=new THttpResponse (); |
|
| 70 | - $response->setBufferOutput(true); |
|
| 71 | - self::assertTrue($response->getBufferOutput()); |
|
| 72 | - $response->init (null); |
|
| 73 | - try { |
|
| 74 | - $response->setBufferOutput(false); |
|
| 75 | - self::fail ('Expected TInvalidOperationException not thrown'); |
|
| 76 | - } catch (TInvalidOperationException $e) {} |
|
| 69 | + $response=new THttpResponse (); |
|
| 70 | + $response->setBufferOutput(true); |
|
| 71 | + self::assertTrue($response->getBufferOutput()); |
|
| 72 | + $response->init (null); |
|
| 73 | + try { |
|
| 74 | + $response->setBufferOutput(false); |
|
| 75 | + self::fail ('Expected TInvalidOperationException not thrown'); |
|
| 76 | + } catch (TInvalidOperationException $e) {} |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public function testSetStatusCode() { |
| 80 | - $response=new THttpResponse (); |
|
| 81 | - $response->init (null); |
|
| 82 | - $response->setStatusCode(401); |
|
| 83 | - self::assertEquals(401, $response->getStatusCode()); |
|
| 84 | - $response->setStatusCode(200); |
|
| 85 | - self::assertEquals(200, $response->getStatusCode()); |
|
| 80 | + $response=new THttpResponse (); |
|
| 81 | + $response->init (null); |
|
| 82 | + $response->setStatusCode(401); |
|
| 83 | + self::assertEquals(401, $response->getStatusCode()); |
|
| 84 | + $response->setStatusCode(200); |
|
| 85 | + self::assertEquals(200, $response->getStatusCode()); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public function testGetCookies() { |
| 89 | - $response=new THttpResponse (); |
|
| 90 | - $response->init (null); |
|
| 91 | - self::assertInstanceOf('THttpCookieCollection', $response->getCookies()); |
|
| 92 | - self::assertEquals(0, $response->getCookies()->getCount()); |
|
| 89 | + $response=new THttpResponse (); |
|
| 90 | + $response->init (null); |
|
| 91 | + self::assertInstanceOf('THttpCookieCollection', $response->getCookies()); |
|
| 92 | + self::assertEquals(0, $response->getCookies()->getCount()); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | public function testWrite() { |
| 96 | - $response=new THttpResponse (); |
|
| 96 | + $response=new THttpResponse (); |
|
| 97 | 97 | //self::expectOutputString("test string"); |
| 98 | - $response->write("test string"); |
|
| 99 | - self::assertContains ('test string', ob_get_clean()); |
|
| 98 | + $response->write("test string"); |
|
| 99 | + self::assertContains ('test string', ob_get_clean()); |
|
| 100 | 100 | |
| 101 | 101 | } |
| 102 | 102 | |
@@ -105,56 +105,56 @@ discard block |
||
| 105 | 105 | // Don't know how to test headers :(( ... |
| 106 | 106 | throw new PHPUnit_Framework_IncompleteTestError(); |
| 107 | 107 | |
| 108 | - $response=new THttpResponse (); |
|
| 109 | - $response->setBufferOutput(true); |
|
| 110 | - // Suppress warning with headers |
|
| 111 | - $response->writeFile(dirname(__FILE__).'/data/aTarFile.md5', null, 'text/plain', array ('Pragma: public', 'Expires: 0')); |
|
| 108 | + $response=new THttpResponse (); |
|
| 109 | + $response->setBufferOutput(true); |
|
| 110 | + // Suppress warning with headers |
|
| 111 | + $response->writeFile(dirname(__FILE__).'/data/aTarFile.md5', null, 'text/plain', array ('Pragma: public', 'Expires: 0')); |
|
| 112 | 112 | |
| 113 | - self::assertContains('4b1ecb0b243918a8bbfbb4515937be98 aTarFile.tar', ob_get_clean()); |
|
| 113 | + self::assertContains('4b1ecb0b243918a8bbfbb4515937be98 aTarFile.tar', ob_get_clean()); |
|
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | public function testRedirect() { |
| 118 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 118 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public function testReload() { |
| 122 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 122 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | public function testFlush() { |
| 126 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 126 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | public function testSendContentTypeHeader() { |
| 130 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 130 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | public function testClear() { |
| 134 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 134 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | public function testAppendHeader() { |
| 138 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 138 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | public function testAppendLog() { |
| 142 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 142 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | public function testAddCookie() { |
| 146 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 146 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | public function testRemoveCookie() { |
| 150 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 150 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | public function testSetHtmlWriterType() { |
| 154 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 154 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | public function testCreateHtmlWriter() { |
| 158 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 158 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | \ No newline at end of file |
@@ -8,12 +8,12 @@ discard block |
||
| 8 | 8 | */ |
| 9 | 9 | class TCacheHttpSessionTest extends PHPUnit_Framework_TestCase |
| 10 | 10 | { |
| 11 | - protected $app = null; |
|
| 11 | + protected $app = null; |
|
| 12 | 12 | protected static $cache = null; |
| 13 | 13 | protected static $session = null; |
| 14 | 14 | |
| 15 | - protected function setUp() |
|
| 16 | - { |
|
| 15 | + protected function setUp() |
|
| 16 | + { |
|
| 17 | 17 | if(!extension_loaded('memcache')) |
| 18 | 18 | { |
| 19 | 19 | self::markTestSkipped('The memcache extension is not available'); |
@@ -35,74 +35,74 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | protected function tearDown() |
| 38 | - { |
|
| 38 | + { |
|
| 39 | 39 | $this->app = null; |
| 40 | 40 | $this->cache = null; |
| 41 | 41 | $this->session = null; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function testInit() |
|
| 45 | - { |
|
| 46 | - $session = new TCacheHttpSession(); |
|
| 47 | - try |
|
| 48 | - { |
|
| 49 | - $session->init(null); |
|
| 50 | - $this->fail("Expected TConfigurationException is not raised"); |
|
| 51 | - } |
|
| 52 | - catch(TConfigurationException $e) |
|
| 53 | - { |
|
| 54 | - } |
|
| 55 | - unset($session); |
|
| 44 | + public function testInit() |
|
| 45 | + { |
|
| 46 | + $session = new TCacheHttpSession(); |
|
| 47 | + try |
|
| 48 | + { |
|
| 49 | + $session->init(null); |
|
| 50 | + $this->fail("Expected TConfigurationException is not raised"); |
|
| 51 | + } |
|
| 52 | + catch(TConfigurationException $e) |
|
| 53 | + { |
|
| 54 | + } |
|
| 55 | + unset($session); |
|
| 56 | 56 | |
| 57 | - $session = new TCacheHttpSession(); |
|
| 58 | - try |
|
| 59 | - { |
|
| 60 | - $session->setCacheModuleID('MaiCache'); |
|
| 61 | - $session->init(null); |
|
| 62 | - $this->fail("Expected TConfigurationException is not raised"); |
|
| 63 | - $session->open(); |
|
| 64 | - } |
|
| 65 | - catch(TConfigurationException $e) |
|
| 66 | - { |
|
| 67 | - } |
|
| 68 | - unset($session); |
|
| 57 | + $session = new TCacheHttpSession(); |
|
| 58 | + try |
|
| 59 | + { |
|
| 60 | + $session->setCacheModuleID('MaiCache'); |
|
| 61 | + $session->init(null); |
|
| 62 | + $this->fail("Expected TConfigurationException is not raised"); |
|
| 63 | + $session->open(); |
|
| 64 | + } |
|
| 65 | + catch(TConfigurationException $e) |
|
| 66 | + { |
|
| 67 | + } |
|
| 68 | + unset($session); |
|
| 69 | 69 | |
| 70 | - self::$session = new TCacheHttpSession(); |
|
| 71 | - try |
|
| 72 | - { |
|
| 73 | - self::$session->setCacheModuleID('MyCache'); |
|
| 74 | - self::$session->init(null); |
|
| 75 | - } |
|
| 76 | - catch(TConfigurationException $e) |
|
| 77 | - { |
|
| 78 | - $this->fail('TConfigurationException is not expected'); |
|
| 79 | - self::markTestSkipped('Cannot continue this test'); |
|
| 80 | - } |
|
| 81 | - } |
|
| 70 | + self::$session = new TCacheHttpSession(); |
|
| 71 | + try |
|
| 72 | + { |
|
| 73 | + self::$session->setCacheModuleID('MyCache'); |
|
| 74 | + self::$session->init(null); |
|
| 75 | + } |
|
| 76 | + catch(TConfigurationException $e) |
|
| 77 | + { |
|
| 78 | + $this->fail('TConfigurationException is not expected'); |
|
| 79 | + self::markTestSkipped('Cannot continue this test'); |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - public function testGetCache() |
|
| 84 | - { |
|
| 85 | - $cache = self::$session->getCache(); |
|
| 86 | - $this->assertEquals(true, $cache instanceof TMemCache); |
|
| 87 | - } |
|
| 83 | + public function testGetCache() |
|
| 84 | + { |
|
| 85 | + $cache = self::$session->getCache(); |
|
| 86 | + $this->assertEquals(true, $cache instanceof TMemCache); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - public function testCacheModuleID() |
|
| 90 | - { |
|
| 91 | - $id = 'value'; |
|
| 92 | - self::$session->setCacheModuleID($id); |
|
| 93 | - self::assertEquals($id, self::$session->getCacheModuleID()); |
|
| 94 | - } |
|
| 89 | + public function testCacheModuleID() |
|
| 90 | + { |
|
| 91 | + $id = 'value'; |
|
| 92 | + self::$session->setCacheModuleID($id); |
|
| 93 | + self::assertEquals($id, self::$session->getCacheModuleID()); |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - public function testKeyPrefix() |
|
| 97 | - { |
|
| 98 | - $id = 'value'; |
|
| 99 | - self::$session->setKeyPrefix($id); |
|
| 100 | - self::assertEquals($id, self::$session->getKeyPrefix()); |
|
| 101 | - } |
|
| 96 | + public function testKeyPrefix() |
|
| 97 | + { |
|
| 98 | + $id = 'value'; |
|
| 99 | + self::$session->setKeyPrefix($id); |
|
| 100 | + self::assertEquals($id, self::$session->getKeyPrefix()); |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - public function testSetAndGet() |
|
| 104 | - { |
|
| 105 | - self::$session['key'] = 'value'; |
|
| 103 | + public function testSetAndGet() |
|
| 104 | + { |
|
| 105 | + self::$session['key'] = 'value'; |
|
| 106 | 106 | self::assertEquals('value', self::$session['key']); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -15,114 +15,114 @@ |
||
| 15 | 15 | private $transformPath; |
| 16 | 16 | |
| 17 | 17 | public function setUp() { |
| 18 | - $this->documentPath = dirname(__FILE__).'/data/hello.xml'; |
|
| 19 | - $this->documentContent = file_get_contents($this->documentPath); |
|
| 20 | - $this->transformPath = dirname(__FILE__).'/data/hello.xsl'; |
|
| 21 | - $this->transformContent = file_get_contents($this->transformPath); |
|
| 18 | + $this->documentPath = dirname(__FILE__).'/data/hello.xml'; |
|
| 19 | + $this->documentContent = file_get_contents($this->documentPath); |
|
| 20 | + $this->transformPath = dirname(__FILE__).'/data/hello.xsl'; |
|
| 21 | + $this->transformContent = file_get_contents($this->transformPath); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function testSetDocumentContent() { |
| 25 | - $expected = $this->documentContent; |
|
| 26 | - $transform = new TXmlTransform(); |
|
| 27 | - $transform->setDocumentContent($expected); |
|
| 28 | - $this->assertEquals($expected, $transform->getDocumentContent()); |
|
| 25 | + $expected = $this->documentContent; |
|
| 26 | + $transform = new TXmlTransform(); |
|
| 27 | + $transform->setDocumentContent($expected); |
|
| 28 | + $this->assertEquals($expected, $transform->getDocumentContent()); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function testSetDocumentPathAsFile() { |
| 32 | - $expected = $this->documentPath; |
|
| 33 | - $transform = new TXmlTransform(); |
|
| 34 | - $transform->setDocumentPath($expected); |
|
| 35 | - $this->assertEquals($expected, $transform->getDocumentPath()); |
|
| 32 | + $expected = $this->documentPath; |
|
| 33 | + $transform = new TXmlTransform(); |
|
| 34 | + $transform->setDocumentPath($expected); |
|
| 35 | + $this->assertEquals($expected, $transform->getDocumentPath()); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function testSetDocumentPathAsNamespace() { |
| 39 | - if(Prado::getPathOfAlias('UnitTest') === null) { |
|
| 40 | - Prado::setPathOfAlias('UnitTest', dirname(__FILE__).'/data'); |
|
| 41 | - } |
|
| 42 | - $expected = $this->documentPath; |
|
| 43 | - $transform = new TXmlTransform(); |
|
| 44 | - $transform->setDocumentPath('UnitTest.hello'); |
|
| 45 | - $this->assertEquals($expected, $transform->getDocumentPath()); |
|
| 39 | + if(Prado::getPathOfAlias('UnitTest') === null) { |
|
| 40 | + Prado::setPathOfAlias('UnitTest', dirname(__FILE__).'/data'); |
|
| 41 | + } |
|
| 42 | + $expected = $this->documentPath; |
|
| 43 | + $transform = new TXmlTransform(); |
|
| 44 | + $transform->setDocumentPath('UnitTest.hello'); |
|
| 45 | + $this->assertEquals($expected, $transform->getDocumentPath()); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function testSetTransformContent() { |
| 49 | - $expected = $this->transformContent; |
|
| 50 | - $transform = new TXmlTransform(); |
|
| 51 | - $transform->setTransformContent($expected); |
|
| 52 | - $this->assertEquals($expected, $transform->getTransformContent()); |
|
| 49 | + $expected = $this->transformContent; |
|
| 50 | + $transform = new TXmlTransform(); |
|
| 51 | + $transform->setTransformContent($expected); |
|
| 52 | + $this->assertEquals($expected, $transform->getTransformContent()); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function testSetTransformPathAsFile() { |
| 56 | - $expected = $this->transformPath; |
|
| 57 | - $transform = new TXmlTransform(); |
|
| 58 | - $transform->setTransformPath($expected); |
|
| 59 | - $this->assertEquals($expected, $transform->getTransformPath()); |
|
| 56 | + $expected = $this->transformPath; |
|
| 57 | + $transform = new TXmlTransform(); |
|
| 58 | + $transform->setTransformPath($expected); |
|
| 59 | + $this->assertEquals($expected, $transform->getTransformPath()); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public function testSetTransformPathAsNamespace() { |
| 63 | - if(Prado::getPathOfAlias('UnitTest') === null) { |
|
| 64 | - Prado::setPathOfAlias('UnitTest', dirname(__FILE__).'/data'); |
|
| 65 | - } |
|
| 66 | - $expected = $this->transformPath; |
|
| 67 | - $transform = new TXmlTransform(); |
|
| 68 | - $transform->setTransformPath('UnitTest.hello'); |
|
| 69 | - $this->assertEquals($expected, $transform->getTransformPath()); |
|
| 63 | + if(Prado::getPathOfAlias('UnitTest') === null) { |
|
| 64 | + Prado::setPathOfAlias('UnitTest', dirname(__FILE__).'/data'); |
|
| 65 | + } |
|
| 66 | + $expected = $this->transformPath; |
|
| 67 | + $transform = new TXmlTransform(); |
|
| 68 | + $transform->setTransformPath('UnitTest.hello'); |
|
| 69 | + $this->assertEquals($expected, $transform->getTransformPath()); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | public function testAddParameter() { |
| 73 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 73 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | public function testRenderWithDocumentContentAndTransformContent() { |
| 77 | - $expected = "<b>Hello World!</b>\n"; |
|
| 78 | - $transform = new TXmlTransform(); |
|
| 79 | - $transform->setDocumentContent($this->documentContent); |
|
| 80 | - $transform->setTransformContent($this->transformContent); |
|
| 81 | - $textWriter = new TTextWriter(); |
|
| 82 | - $htmlWriter = new THtmlWriter($textWriter); |
|
| 83 | - $transform->render($htmlWriter); |
|
| 84 | - $actual = $textWriter->flush(); |
|
| 85 | - self::assertEquals($expected, $actual); |
|
| 77 | + $expected = "<b>Hello World!</b>\n"; |
|
| 78 | + $transform = new TXmlTransform(); |
|
| 79 | + $transform->setDocumentContent($this->documentContent); |
|
| 80 | + $transform->setTransformContent($this->transformContent); |
|
| 81 | + $textWriter = new TTextWriter(); |
|
| 82 | + $htmlWriter = new THtmlWriter($textWriter); |
|
| 83 | + $transform->render($htmlWriter); |
|
| 84 | + $actual = $textWriter->flush(); |
|
| 85 | + self::assertEquals($expected, $actual); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public function testRenderWithDocumentPathAndTransformContent() { |
| 89 | - $expected = "<b>Hello World!</b>\n"; |
|
| 90 | - $transform = new TXmlTransform(); |
|
| 91 | - $transform->setDocumentPath($this->documentPath); |
|
| 92 | - $transform->setTransformContent($this->transformContent); |
|
| 93 | - $textWriter = new TTextWriter(); |
|
| 94 | - $htmlWriter = new THtmlWriter($textWriter); |
|
| 95 | - $transform->render($htmlWriter); |
|
| 96 | - $actual = $textWriter->flush(); |
|
| 97 | - self::assertEquals($expected, $actual); |
|
| 89 | + $expected = "<b>Hello World!</b>\n"; |
|
| 90 | + $transform = new TXmlTransform(); |
|
| 91 | + $transform->setDocumentPath($this->documentPath); |
|
| 92 | + $transform->setTransformContent($this->transformContent); |
|
| 93 | + $textWriter = new TTextWriter(); |
|
| 94 | + $htmlWriter = new THtmlWriter($textWriter); |
|
| 95 | + $transform->render($htmlWriter); |
|
| 96 | + $actual = $textWriter->flush(); |
|
| 97 | + self::assertEquals($expected, $actual); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | public function testRenderWithDocumentContentAndTransformPath() { |
| 101 | - $expected = "<b>Hello World!</b>\n"; |
|
| 102 | - $transform = new TXmlTransform(); |
|
| 103 | - $transform->setDocumentContent($this->documentContent); |
|
| 104 | - $transform->setTransformPath($this->transformPath); |
|
| 105 | - $textWriter = new TTextWriter(); |
|
| 106 | - $htmlWriter = new THtmlWriter($textWriter); |
|
| 107 | - $transform->render($htmlWriter); |
|
| 108 | - $actual = $textWriter->flush(); |
|
| 109 | - self::assertEquals($expected, $actual); |
|
| 101 | + $expected = "<b>Hello World!</b>\n"; |
|
| 102 | + $transform = new TXmlTransform(); |
|
| 103 | + $transform->setDocumentContent($this->documentContent); |
|
| 104 | + $transform->setTransformPath($this->transformPath); |
|
| 105 | + $textWriter = new TTextWriter(); |
|
| 106 | + $htmlWriter = new THtmlWriter($textWriter); |
|
| 107 | + $transform->render($htmlWriter); |
|
| 108 | + $actual = $textWriter->flush(); |
|
| 109 | + self::assertEquals($expected, $actual); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | public function testRenderWithDocumentPathAndTransformPath() { |
| 113 | - $expected = "<b>Hello World!</b>\n"; |
|
| 114 | - $transform = new TXmlTransform(); |
|
| 115 | - $transform->setDocumentPath($this->documentPath); |
|
| 116 | - $transform->setTransformPath($this->transformPath); |
|
| 117 | - $textWriter = new TTextWriter(); |
|
| 118 | - $htmlWriter = new THtmlWriter($textWriter); |
|
| 119 | - $transform->render($htmlWriter); |
|
| 120 | - $actual = $textWriter->flush(); |
|
| 121 | - self::assertEquals($expected, $actual); |
|
| 113 | + $expected = "<b>Hello World!</b>\n"; |
|
| 114 | + $transform = new TXmlTransform(); |
|
| 115 | + $transform->setDocumentPath($this->documentPath); |
|
| 116 | + $transform->setTransformPath($this->transformPath); |
|
| 117 | + $textWriter = new TTextWriter(); |
|
| 118 | + $htmlWriter = new THtmlWriter($textWriter); |
|
| 119 | + $transform->render($htmlWriter); |
|
| 120 | + $actual = $textWriter->flush(); |
|
| 121 | + self::assertEquals($expected, $actual); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | public function testRenderWithBodyAsDocumentAndTransformPath() { |
| 125 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 125 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |