aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/UtilsTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-05-25 15:28:26 +0200
committerGitHub <noreply@github.com>2017-05-25 15:28:26 +0200
commit81a91579ba8eb7b5a203722baf927a3653b5cb94 (patch)
tree228456f9b4d95d03e97fc9bc1b5004aa599f95ee /tests/UtilsTest.php
parent8b27824338eb445d69730c9b05f05b131ccea52f (diff)
parent82e3bb5f06dc531ee1080a0313833791a1c1f3c7 (diff)
downloadShaarli-81a91579ba8eb7b5a203722baf927a3653b5cb94.tar.gz
Shaarli-81a91579ba8eb7b5a203722baf927a3653b5cb94.tar.zst
Shaarli-81a91579ba8eb7b5a203722baf927a3653b5cb94.zip
Merge pull request #835 from ArthurHoaro/feature/tag-cloud
Adds a taglist view with edit/delete buttons
Diffstat (limited to 'tests/UtilsTest.php')
-rw-r--r--tests/UtilsTest.php112
1 files changed, 112 insertions, 0 deletions
diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php
index d6a0aad5..3d1aa653 100644
--- a/tests/UtilsTest.php
+++ b/tests/UtilsTest.php
@@ -417,4 +417,116 @@ class UtilsTest extends PHPUnit_Framework_TestCase
417 $this->assertEquals('1048576', get_max_upload_size('1m', '2m', false)); 417 $this->assertEquals('1048576', get_max_upload_size('1m', '2m', false));
418 $this->assertEquals('100', get_max_upload_size(100, 100, false)); 418 $this->assertEquals('100', get_max_upload_size(100, 100, false));
419 } 419 }
420
421 /**
422 * Test alphabetical_sort by value, not reversed, with php-intl.
423 */
424 public function testAlphabeticalSortByValue()
425 {
426 $arr = [
427 'zZz',
428 'éee',
429 'éae',
430 'eee',
431 'A',
432 'a',
433 'zzz',
434 ];
435 $expected = [
436 'a',
437 'A',
438 'éae',
439 'eee',
440 'éee',
441 'zzz',
442 'zZz',
443 ];
444
445 alphabetical_sort($arr);
446 $this->assertEquals($expected, $arr);
447 }
448
449 /**
450 * Test alphabetical_sort by value, reversed, with php-intl.
451 */
452 public function testAlphabeticalSortByValueReversed()
453 {
454 $arr = [
455 'zZz',
456 'éee',
457 'éae',
458 'eee',
459 'A',
460 'a',
461 'zzz',
462 ];
463 $expected = [
464 'zZz',
465 'zzz',
466 'éee',
467 'eee',
468 'éae',
469 'A',
470 'a',
471 ];
472
473 alphabetical_sort($arr, true);
474 $this->assertEquals($expected, $arr);
475 }
476
477 /**
478 * Test alphabetical_sort by keys, not reversed, with php-intl.
479 */
480 public function testAlphabeticalSortByKeys()
481 {
482 $arr = [
483 'zZz' => true,
484 'éee' => true,
485 'éae' => true,
486 'eee' => true,
487 'A' => true,
488 'a' => true,
489 'zzz' => true,
490 ];
491 $expected = [
492 'a' => true,
493 'A' => true,
494 'éae' => true,
495 'eee' => true,
496 'éee' => true,
497 'zzz' => true,
498 'zZz' => true,
499 ];
500
501 alphabetical_sort($arr, true, true);
502 $this->assertEquals($expected, $arr);
503 }
504
505 /**
506 * Test alphabetical_sort by keys, reversed, with php-intl.
507 */
508 public function testAlphabeticalSortByKeysReversed()
509 {
510 $arr = [
511 'zZz' => true,
512 'éee' => true,
513 'éae' => true,
514 'eee' => true,
515 'A' => true,
516 'a' => true,
517 'zzz' => true,
518 ];
519 $expected = [
520 'zZz' => true,
521 'zzz' => true,
522 'éee' => true,
523 'eee' => true,
524 'éae' => true,
525 'A' => true,
526 'a' => true,
527 ];
528
529 alphabetical_sort($arr, true, true);
530 $this->assertEquals($expected, $arr);
531 }
420} 532}