testReturnsTruncatedStringWithEllipse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
/**
3
 * This file is part of the Axstrad library.
4
 *
5
 * (c) Dan Kempster <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @copyright 2014-2015 Dan Kempster <[email protected]>
11
 */
12
namespace Axstrad\Common\Tests\Util\StrUtil;
13
14
use Axstrad\Common\Util\StrUtil;
15
16
17
/**
18
 * Axstrad\Common\Tests\Util\StrUtil\EllipseTest
19
 *
20
 * covers Axstrad\Common\Util\StrUtil::ellipse
21
 * @group unittests
22
 */
23
class EllipseTest extends \PHPUnit_Framework_TestCase
24
{
25
    public function testReturnsStringWhenShorterThenMaxLength()
26
    {
27
        $this->assertEquals(
28
            "Hello World",
29
            StrUtil::ellipse(
30
                "Hello World",
31
                20
32
            )
33
        );
34
    }
35
36
    public function testReturnsTruncatedStringWithEllipse()
37
    {
38
        $this->assertEquals(
39
            "Hello Worl...",
40
            StrUtil::ellipse(
41
                "Hello World",
42
                10
43
            )
44
        );
45
    }
46
}
47