|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * This file is part of the phpunit-mink library. |
| 4 | + * For the full copyright and license information, please view |
| 5 | + * the LICENSE file that was distributed with this source code. |
| 6 | + * |
| 7 | + * @copyright Alexander Obuhovich <aik.bold@gmail.com> |
| 8 | + * @link https://github.com/aik099/phpunit-mink |
| 9 | + */ |
| 10 | + |
| 11 | +namespace tests\aik099\PHPUnit\Integration; |
| 12 | + |
| 13 | + |
| 14 | +use aik099\PHPUnit\BrowserTestCase; |
| 15 | + |
| 16 | +abstract class SauceLabsAwareTestCase extends BrowserTestCase |
| 17 | +{ |
| 18 | + |
| 19 | + /** |
| 20 | + * Browser list to be used in tests. |
| 21 | + * |
| 22 | + * @var array |
| 23 | + */ |
| 24 | + public static $browsers = array( |
| 25 | + array('alias' => 'saucelabs'), |
| 26 | + ); |
| 27 | + |
| 28 | + /** |
| 29 | + * Set session meta-info for "Sauce Labs". |
| 30 | + * |
| 31 | + * @return void |
| 32 | + */ |
| 33 | + protected function setUp() |
| 34 | + { |
| 35 | + if ( !getenv('SAUCE_USERNAME') || !getenv('SAUCE_ACCESS_KEY') ) { |
| 36 | + $this->markTestSkipped('SauceLabs integration is not configured'); |
| 37 | + } |
| 38 | + |
| 39 | + parent::setUp(); |
| 40 | + } |
| 41 | + |
| 42 | + /** |
| 43 | + * Whatever or not code coverage information should be gathered. |
| 44 | + * |
| 45 | + * @return boolean |
| 46 | + * @throws \RuntimeException When used before test is started. |
| 47 | + */ |
| 48 | + public function getCollectCodeCoverageInformation() |
| 49 | + { |
| 50 | + // FIXME: Workaround for https://github.com/minkphp/phpunit-mink/issues/35 bug. |
| 51 | + return false; |
| 52 | + } |
| 53 | + |
| 54 | + /** |
| 55 | + * Gets browser configuration aliases. |
| 56 | + * |
| 57 | + * Allows to decouple actual test server connection details from test cases. |
| 58 | + * |
| 59 | + * @return array |
| 60 | + */ |
| 61 | + public function getBrowserAliases() |
| 62 | + { |
| 63 | + return array( |
| 64 | + 'saucelabs' => array( |
| 65 | + 'type' => 'saucelabs', |
| 66 | + 'apiUsername' => getenv('SAUCE_USERNAME'), |
| 67 | + 'apiKey' => getenv('SAUCE_ACCESS_KEY'), |
| 68 | + |
| 69 | + 'browserName' => 'chrome', |
| 70 | + 'desiredCapabilities' => array('version' => 28), |
| 71 | + 'baseUrl' => 'http://www.google.com', |
| 72 | + ), |
| 73 | + ); |
| 74 | + } |
| 75 | + |
| 76 | +} |
0 commit comments