Completed
Pull Request — master (#148)
by Kevin
02:16
created

Displayed::assert()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 8

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
dl 12
loc 12
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 8
nc 2
nop 0
1
<?php
2
3
namespace Magium\Assertions\Element;
4
5
6 View Code Duplication
class Displayed extends AbstractSelectorAssertion
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
7
{
8
9
    const ASSERTION = 'Element\Displayed';
10
11
    public function assert()
12
    {
13
        $this->getTestCase()->assertElementExists($this->selector, $this->by);
14
        try {
15
            $this->getTestCase()->assertTrue(
16
                $this->webDriver->{$this->by}($this->selector)->isDisplayed(),
17
                sprintf('The element: %s, is not displayed and it should have been', $this->selector)
18
            );
19
        } catch (\Exception $e) {
20
            $this->getTestCase()->fail(sprintf('Element "%s" using selector "%s" is displayed', $this->selector, $this->by));
21
        }
22
    }
23
24
}