Test Failed
Push — master ( 6cef4a...19943b )
by Jean-Christophe
02:49
created

UStringTest::_after()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 1
rs 10
1
<?php
2
use Ubiquity\utils\base\UString;
3
class UStringTest extends \Codeception\Test\Unit {
4
	/**
5
	 *
6
	 * @var \UnitTester
7
	 */
8
	protected $tester;
9
10
	protected function _before() {
11
	}
12
13
	protected function _after() {
14
	}
15
16
	// tests
17
	public function testCleanAttribute() {
18
		$this->assertEquals ( "attr-ta-", UString::cleanAttribute ( "attr ta%%" ) );
19
		$this->assertEquals ( "attr", UString::cleanAttribute ( "attr" ) );
20
		$this->assertEquals ( "attr01", UString::cleanAttribute ( "attr01" ) );
21
		$this->assertEquals ( "01attr01", UString::cleanAttribute ( "01attr01" ) );
22
		$this->assertEquals ( "01attr", UString::cleanAttribute ( "01attr" ) );
23
		$this->assertEquals ( "attri-bute", UString::cleanAttribute ( "attri-bute" ) );
24
		$this->assertEquals ( "attri-bute", UString::cleanAttribute ( "attri--bute" ) );
25
		// $this->assertEquals ( "attri-bute", UString::cleanAttribute ( "attri---bute" ) );
26
	}
27
28
	public function testStartsWith() {
29
		$this->assertTrue ( UString::startswith ( '-test', '-' ) );
30
		$this->assertFalse ( UString::startswith ( 'test', '-' ) );
31
		$this->assertFalse ( UString::startswith ( '', '-' ) );
32
		$this->assertFalse ( UString::startswith ( null, '-' ) );
33
	}
34
35
	public function testEndsWith() {
36
		$this->assertTrue ( UString::endswith ( '-test', 't' ) );
37
		$this->assertFalse ( UString::endswith ( 'test', '-' ) );
38
		$this->assertFalse ( UString::endswith ( '', '-' ) );
39
		$this->assertFalse ( UString::endswith ( null, '-' ) );
40
	}
41
}