@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | public function evaluate($string) |
| 25 | 25 | { |
| 26 | - $string = '<?php ' . $string; |
|
| 26 | + $string = '<?php '.$string; |
|
| 27 | 27 | $comparison1 = $comparison2 = ''; |
| 28 | 28 | $operator = null; |
| 29 | 29 | $tokens = token_get_all($string); |
@@ -49,10 +49,14 @@ |
||
| 49 | 49 | |
| 50 | 50 | if ($operator === null) { |
| 51 | 51 | $isTrue = in_array($comparison1, $this->reservedTrue); |
| 52 | - if ($isTrue) return true; |
|
| 52 | + if ($isTrue) { |
|
| 53 | + return true; |
|
| 54 | + } |
|
| 53 | 55 | |
| 54 | 56 | $isFalse = in_array($comparison1, $this->reservedFalse); |
| 55 | - if ($isFalse) return false; |
|
| 57 | + if ($isFalse) { |
|
| 58 | + return false; |
|
| 59 | + } |
|
| 56 | 60 | |
| 57 | 61 | return (boolean)$comparison1; |
| 58 | 62 | } else { |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | $isVendor = array_pop($testParts) == 'vendor'; |
| 45 | 45 | |
| 46 | 46 | if ($isVendor) { |
| 47 | - $path = realpath(__DIR__ . '/../../../../..'); // Get out of the Magium directories |
|
| 47 | + $path = realpath(__DIR__.'/../../../../..'); // Get out of the Magium directories |
|
| 48 | 48 | } else { |
| 49 | - $path = realpath(__DIR__ . '/../../..'); |
|
| 49 | + $path = realpath(__DIR__.'/../../..'); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $count = 0; |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | $classes = $this->introspectClass($config); |
| 77 | 77 | |
| 78 | 78 | foreach ($classes as $class) { |
| 79 | - $configurationFile = $class . '.php'; |
|
| 80 | - $configurationFile = $configurationDir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $configurationFile); |
|
| 79 | + $configurationFile = $class.'.php'; |
|
| 80 | + $configurationFile = $configurationDir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $configurationFile); |
|
| 81 | 81 | |
| 82 | 82 | if (file_exists($configurationFile)) { |
| 83 | 83 | include $configurationFile; |
@@ -71,7 +71,9 @@ |
||
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if (!is_dir($configurationDir)) return; |
|
| 74 | + if (!is_dir($configurationDir)) { |
|
| 75 | + return; |
|
| 76 | + } |
|
| 75 | 77 | |
| 76 | 78 | $classes = $this->introspectClass($config); |
| 77 | 79 | |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | $reflectionClass = $class; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - foreach ($originalReflectionClass->getInterfaceNames() as $name){ |
|
| 27 | + foreach ($originalReflectionClass->getInterfaceNames() as $name) { |
|
| 28 | 28 | $this->addClass($name); |
| 29 | 29 | $interfaces[] = $name; |
| 30 | 30 | $reflectionInterface = new \ReflectionClass($name); |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | } |
| 35 | 35 | try { |
| 36 | 36 | $assertion->assert(); |
| 37 | - $this->logger->logAssertionSuccess( $assertion, $extra ); |
|
| 37 | + $this->logger->logAssertionSuccess($assertion, $extra); |
|
| 38 | 38 | } catch (\Exception $e) { |
| 39 | 39 | $this->logger->logAssertionFailure($e, $assertion, $extra); |
| 40 | 40 | $this->testCase->fail($e->getMessage()); |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | |
| 23 | 23 | public function interpolate($string) |
| 24 | 24 | { |
| 25 | - $this->logger->info('Interpolating string: ' . $string); |
|
| 25 | + $this->logger->info('Interpolating string: '.$string); |
|
| 26 | 26 | $matches = null; |
| 27 | 27 | // Finding {{$product->setEntityId(123)->load()}} type methods |
| 28 | 28 | if (preg_match('/\{\{(?:\$)([^{]+)\}\}/', $string, $matches)) { |
@@ -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; |
@@ -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 | |
@@ -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 { |