Code Duplication    Length = 16-18 lines in 5 locations

lib/Assertions/Browser/TitleContains.php 1 location

@@ 8-25 (lines=18) @@
5
use Magium\Assertions\AbstractAssertion;
6
use Magium\Assertions\SelectorAssertionInterface;
7
8
class TitleContains extends AbstractAssertion implements SelectorAssertionInterface
9
{
10
    use TitleTrait;
11
12
    const ASSERTION = 'Browser\TitleContains';
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
23
    }
24
25
}
26

lib/Assertions/Browser/TitleEquals.php 1 location

@@ 8-23 (lines=16) @@
5
use Magium\Assertions\AbstractAssertion;
6
use Magium\Assertions\SelectorAssertionInterface;
7
8
class TitleEquals extends AbstractAssertion implements SelectorAssertionInterface
9
{
10
    use TitleTrait;
11
12
    const ASSERTION = 'Browser\TitleEquals';
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
        \PHPUnit_Framework_TestCase::assertEquals($title, $this->title);
21
    }
22
23
}
24

lib/Assertions/Browser/TitleNotContains.php 1 location

@@ 8-25 (lines=18) @@
5
use Magium\Assertions\AbstractAssertion;
6
use Magium\Assertions\SelectorAssertionInterface;
7
8
class TitleNotContains extends AbstractAssertion implements SelectorAssertionInterface
9
{
10
    use TitleTrait;
11
12
    const ASSERTION = 'Browser\TitleNotContains';
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::assertFalse($pos);
22
23
    }
24
25
}
26

lib/Assertions/Browser/TitleNotEquals.php 1 location

@@ 8-23 (lines=16) @@
5
use Magium\Assertions\AbstractAssertion;
6
use Magium\Assertions\SelectorAssertionInterface;
7
8
class TitleNotEquals extends AbstractAssertion implements SelectorAssertionInterface
9
{
10
    use TitleTrait;
11
12
    const ASSERTION = 'Browser\TitleNotEquals';
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
        \PHPUnit_Framework_TestCase::assertNotEquals($title, $this->title);
21
    }
22
23
}
24

lib/Assertions/Browser/TitleStartsWith.php 1 location

@@ 8-25 (lines=18) @@
5
use Magium\Assertions\AbstractAssertion;
6
use Magium\Assertions\SelectorAssertionInterface;
7
8
class TitleStartsWith extends AbstractAssertion implements SelectorAssertionInterface
9
{
10
    use TitleTrait;
11
12
    const ASSERTION = 'Browser\TitleStartsWith';
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
        \PHPUnit_Framework_TestCase::assertEquals(0, $pos);
23
    }
24
25
}
26