Completed
Push — master ( 94d001...354cb1 )
by Kevin
04:53 queued 02:28
created

TitleEndsWith   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 4
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A assert() 0 12 1
1
<?php
2
3
namespace Magium\Assertions\Browser;
4
5
use Magium\Assertions\AbstractAssertion;
6
use Magium\Assertions\SelectorAssertionInterface;
7
8
class TitleEndsWith extends AbstractAssertion implements SelectorAssertionInterface
9
{
10
    use TitleTrait;
11
12
    const ASSERTION = 'Browser\TitleEndsWith';
13
14
    public function assert()
15
    {
16
        $title = $this->webDriver->getTitle();
17
        \PHPUnit_Framework_TestCase::assertNotNull($title);
18
        \PHPUnit_Framework_TestCase::assertNotNull($this->title);
19
        $title = trim($title);
20
        $pos = strpos($title, $this->title);
21
        \PHPUnit_Framework_TestCase::assertNotFalse($pos);
22
        $testEquals = $pos + strlen($this->title);
23
        $browserEquals = strlen($title);
24
        \PHPUnit_Framework_TestCase::assertEquals($testEquals, $browserEquals);
25
    }
26
27
}
28