@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Facebook\WebDriver\WebDriverBy; |
6 | 6 | use Magium\AbstractTestCase; |
7 | -use Magium\InvalidTestTypeException; |
|
8 | 7 | use Magium\WebDriver\ExpectedCondition; |
9 | 8 | |
10 | 9 | class Clickable extends AbstractSelectorAssertion |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Facebook\WebDriver\WebDriverBy; |
6 | 6 | use Magium\AbstractTestCase; |
7 | -use Magium\InvalidTestTypeException; |
|
8 | 7 | use Magium\WebDriver\ExpectedCondition; |
9 | 8 | |
10 | 9 | class NotClickable extends AbstractSelectorAssertion |
@@ -45,11 +45,17 @@ |
||
45 | 45 | return $this->invokedTest; |
46 | 46 | } |
47 | 47 | |
48 | + /** |
|
49 | + * @param string $name |
|
50 | + */ |
|
48 | 51 | public function setTestName($name) |
49 | 52 | { |
50 | 53 | $this->testName = $name; |
51 | 54 | } |
52 | 55 | |
56 | + /** |
|
57 | + * @param string $status |
|
58 | + */ |
|
53 | 59 | public function setTestStatus($status) |
54 | 60 | { |
55 | 61 | $this->status = $status; |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | public function logAssertionSuccess(AbstractAssertion $assertion, array $extra) |
69 | 69 | { |
70 | 70 | $extra = array_merge($extra, ['type' => 'assertion', 'result' => self::STATUS_PASSED]); |
71 | - $this->info(get_class($assertion) . ' - passed', $this->createExtra($extra)); |
|
71 | + $this->info(get_class($assertion).' - passed', $this->createExtra($extra)); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function logAssertionFailure(Exception $e, AbstractAssertion $assertion, array $extra) |
75 | 75 | { |
76 | 76 | $extra = array_merge($extra, ['type' => 'assertion', 'result' => self::STATUS_FAILED, 'stack_trace' => $e->getTrace()]); |
77 | - $this->err(get_class($assertion) . ' - ' . $e->getMessage(), $this->createExtra($extra)); |
|
77 | + $this->err(get_class($assertion).' - '.$e->getMessage(), $this->createExtra($extra)); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | public function createExtra($includeArray = []) |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | { |
137 | 137 | if ($test instanceof TestCase) { |
138 | 138 | if (!$this->testName) { |
139 | - $this->setTestName(get_class($test) . '::' . $test->getName()); |
|
139 | + $this->setTestName(get_class($test).'::'.$test->getName()); |
|
140 | 140 | } |
141 | - $this->invokedTest = get_class($test) . '::' . $test->getName(); |
|
141 | + $this->invokedTest = get_class($test).'::'.$test->getName(); |
|
142 | 142 | $this->setTestStatus(self::STATUS_PASSED); |
143 | 143 | } |
144 | 144 |
@@ -59,6 +59,10 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | + /** |
|
63 | + * @param string $by |
|
64 | + * @param string $selector |
|
65 | + */ |
|
62 | 66 | public function logFind($by, $selector) |
63 | 67 | { |
64 | 68 | if ($this->logger instanceof \Magium\Util\Log\LoggerInterface) { |
@@ -135,6 +139,9 @@ discard block |
||
135 | 139 | return $element; |
136 | 140 | } |
137 | 141 | |
142 | + /** |
|
143 | + * @param string $selector |
|
144 | + */ |
|
138 | 145 | public function elementExists($selector, $by = 'byId') |
139 | 146 | { |
140 | 147 | try { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
214 | - public static function resolveClass( $class, $prefix = null) |
|
214 | + public static function resolveClass($class, $prefix = null) |
|
215 | 215 | { |
216 | 216 | $origClass = $class; |
217 | 217 | if ($prefix !== null) { |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | } |
226 | 226 | |
227 | 227 | foreach (self::$baseNamespaces as $namespace) { |
228 | - $fqClass = $namespace . '\\' . $class; |
|
228 | + $fqClass = $namespace.'\\'.$class; |
|
229 | 229 | try { |
230 | 230 | if (class_exists($fqClass)) { |
231 | 231 | return $fqClass; |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | $element = $this->byXpath(sprintf('//%s[contains(., "%s")]', $node, addslashes($text))); |
518 | 518 | self::assertWebDriverElement($element); |
519 | 519 | } catch (\Exception $e) { |
520 | - $this->fail('The body did not contain the text: ' . $text); |
|
520 | + $this->fail('The body did not contain the text: '.$text); |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | // If the element is not found then an exception will be thrown |
529 | 529 | self::assertWebDriverElement($element); |
530 | 530 | } catch (\Exception $e) { |
531 | - $this->fail('The body did not contain the text: ' . $text); |
|
531 | + $this->fail('The body did not contain the text: '.$text); |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | { |
537 | 537 | try { |
538 | 538 | $this->webdriver->byXpath(sprintf('//body[contains(., "%s")]', $text)); |
539 | - $this->fail('The page contains the words: ' . $text); |
|
539 | + $this->fail('The page contains the words: '.$text); |
|
540 | 540 | } catch (NoSuchElementException $e) { |
541 | 541 | // Exception thrown is a success |
542 | 542 | self::assertInstanceOf(NoSuchElementException::class, $e); |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | { |
578 | 578 | |
579 | 579 | if ($parentElementSelector !== null) { |
580 | - $xpathTemplate = $parentElementSelector . $xpathTemplate; |
|
580 | + $xpathTemplate = $parentElementSelector.$xpathTemplate; |
|
581 | 581 | } |
582 | 582 | if ($specificNodeType !== null) { |
583 | 583 | return $this->byXpath(sprintf($xpathTemplate, $specificNodeType, $this->getTranslator()->translatePlaceholders($text))); |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | } |
591 | 591 | } |
592 | 592 | // This is here for consistency with the other by* methods |
593 | - WebDriverException::throwException(7, 'Could not find element with text: ' . $this->getTranslator()->translatePlaceholders($text), []); |
|
593 | + WebDriverException::throwException(7, 'Could not find element with text: '.$this->getTranslator()->translatePlaceholders($text), []); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | /** |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $this->result = null; |
38 | 38 | } |
39 | 39 | |
40 | - public function addListener( $listener) |
|
40 | + public function addListener($listener) |
|
41 | 41 | { |
42 | 42 | // This pretty piece of code is to maintain compatibility between PHPUnit 5 and 6. |
43 | 43 | if ($listener instanceof \PHPUnit_Framework_TestListener) { |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | public function logAssertionSuccess(AbstractAssertion $assertion, array $extra) |
74 | 74 | { |
75 | 75 | $extra = array_merge($extra, ['type' => 'assertion', 'result' => self::STATUS_PASSED]); |
76 | - $this->info(get_class($assertion) . ' - passed', $this->createExtra($extra)); |
|
76 | + $this->info(get_class($assertion).' - passed', $this->createExtra($extra)); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | public function logAssertionFailure(Exception $e, AbstractAssertion $assertion, array $extra) |
80 | 80 | { |
81 | 81 | $extra = array_merge($extra, ['type' => 'assertion', 'result' => self::STATUS_FAILED, 'stack_trace' => $e->getTrace()]); |
82 | - $this->err(get_class($assertion) . ' - ' . $e->getMessage(), $this->createExtra($extra)); |
|
82 | + $this->err(get_class($assertion).' - '.$e->getMessage(), $this->createExtra($extra)); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | public function createExtra($includeArray = []) |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | { |
147 | 147 | if ($test instanceof TestCase) { |
148 | 148 | if (!$this->testName) { |
149 | - $this->setTestName(get_class($test) . '::' . $test->getName()); |
|
149 | + $this->setTestName(get_class($test).'::'.$test->getName()); |
|
150 | 150 | } |
151 | - $this->invokedTest = get_class($test) . '::' . $test->getName(); |
|
151 | + $this->invokedTest = get_class($test).'::'.$test->getName(); |
|
152 | 152 | $this->setTestStatus(self::STATUS_PASSED); |
153 | 153 | } |
154 | 154 |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | protected function getDefaultConfiguration() |
150 | 150 | { |
151 | 151 | // Choose the correct logger/listener for the version of PHPUnit being used |
152 | - $loggerClass = class_exists('PHPUnit_Framework_TestCase')?LoggerPHPUnit5::class:Logger::class; |
|
152 | + $loggerClass = class_exists('PHPUnit_Framework_TestCase') ?LoggerPHPUnit5::class : Logger::class; |
|
153 | 153 | |
154 | 154 | return [ |
155 | 155 | 'definition' => [ |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | |
216 | 216 | $count = 0; |
217 | 217 | |
218 | - $path = realpath(__DIR__ . '/../'); |
|
218 | + $path = realpath(__DIR__.'/../'); |
|
219 | 219 | |
220 | 220 | while ($count++ < 5) { |
221 | 221 | $dir = "{$path}/configuration/"; |
222 | 222 | if (is_dir($dir)) { |
223 | - foreach (glob($dir . '*.php') as $file) { |
|
223 | + foreach (glob($dir.'*.php') as $file) { |
|
224 | 224 | $configArray = array_merge_recursive($configArray, include $file); |
225 | 225 | } |
226 | 226 | break; |