-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored tests to use data providers instead of single-test loops t…
…hat take forever
- Loading branch information
1 parent
2f850cf
commit fe40213
Showing
4 changed files
with
124 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the `src-run/rf-app` project. | ||
* | ||
* (c) Rob Frawley 2nd <rmf@src.run> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.md | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Rf\AppBundle\Tests; | ||
|
||
use Symfony\Component\DomCrawler\Crawler; | ||
use Symfony\Component\HttpKernel\Client; | ||
|
||
trait CrawlerTestTrait | ||
{ | ||
/** | ||
* @param string $url | ||
* | ||
* @return Crawler | ||
*/ | ||
private function getClientRequestCrawler(string $url): Crawler | ||
{ | ||
return static::createTestClient()->request('GET', $url); | ||
} | ||
|
||
/** | ||
* @param string $url | ||
*/ | ||
private function assertValidUrl(string $url) | ||
{ | ||
$client = static::createTestClient(); | ||
$client->request('GET', $url); | ||
|
||
$this->assertSame(200, $client->getResponse()->getStatusCode()); | ||
} | ||
|
||
/** | ||
* @param array $options | ||
* @param array $server | ||
* | ||
* @return Client | ||
*/ | ||
abstract static function createTestClient(array $options = array(), array $server = array()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters