Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

stringutils.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Copyright (c) 2014 Lukas Reschke <lukas@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. use \OC\Security\StringUtils;
  9. class StringUtilsTest extends \Test\TestCase {
  10. public function dataProvider()
  11. {
  12. return array(
  13. array('Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.'),
  14. array('', ''),
  15. array('我看这本书。 我看這本書', '我看这本书。 我看這本書'),
  16. array('GpKY9fSnWNJbES99zVGvA', 'GpKY9fSnWNJbES99zVGvA')
  17. );
  18. }
  19. /**
  20. * @dataProvider dataProvider
  21. */
  22. function testWrongEquals($string) {
  23. $this->assertFalse(StringUtils::equals($string, 'A Completely Wrong String'));
  24. $this->assertFalse(StringUtils::equals($string, null));
  25. }
  26. /**
  27. * @dataProvider dataProvider
  28. */
  29. function testTrueEquals($string, $expected) {
  30. $this->assertTrue(StringUtils::equals($string, $expected));
  31. }
  32. }