NotExists   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A assert() 0 13 3
1
<?php
2
3
namespace Magium\Assertions\Element;
4
5
6
use Magium\AbstractTestCase;
7
8
class NotExists extends AbstractSelectorAssertion
9
{
10
11
    const ASSERTION = 'Element\NotExists';
12
13
    public function assert()
14
    {
15
        $exceptionThrown = false;
16
        try {
17
            $this->getTestCase()->assertWebDriverElement($this->webDriver->{$this->by}($this->selector));
18
        } catch (\Exception $e) {
19
            $exceptionThrown = true;
20
            AbstractTestCase::assertTrue(true); // protection against " test did not perform any assertions"
21
        }
22
        if (!$exceptionThrown) {
23
            $this->getTestCase()->fail(sprintf('Element "%s" was found using selector "%s"', $this->selector, $this->by));
24
        }
25
    }
26
27
}
28