File: Strings.trim%28%29.phpt

package info (click to toggle)
php-nette-utils 4.0.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,420 kB
  • sloc: php: 4,069; xml: 12; makefile: 4
file content (26 lines) | stat: -rw-r--r-- 552 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php

/**
 * Test: Nette\Utils\Strings::trim()
 */

declare(strict_types=1);

use Nette\Utils\Strings;
use Tester\Assert;


require __DIR__ . '/../bootstrap.php';


Assert::same('x', Strings::trim(" \t\n\r\x00\x0B\u{A0}x"));
Assert::same('a b', Strings::trim(' a b '));
Assert::same(' a b ', Strings::trim(' a b ', ''));
Assert::same('e', Strings::trim("\u{158}e-", "\u{158}-")); // Ře-
Assert::same('foo', Strings::trim("\u{2000}\u{200B}foo"));

Assert::exception(
	fn() => Strings::trim("\xC2x\xA0"),
	Nette\Utils\RegexpException::class,
	null,
);