Skip to content

Commit

Permalink
Fixed how the integration tests are organized
Browse files Browse the repository at this point in the history
  • Loading branch information
troydavisson committed Jun 21, 2014
1 parent dc6a692 commit 33768aa
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 67 deletions.
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Expand Up @@ -9,7 +9,7 @@
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php"
bootstrap="tests/bootstrap.php"
>
<testsuites>
<testsuite name="PHRETS Test Suite">
Expand Down
26 changes: 26 additions & 0 deletions tests/Integration/BaseIntegration.php
@@ -0,0 +1,26 @@
<?php

class BaseIntegration extends PHPUnit_Framework_TestCase
{

protected $client;
/** @var \PHRETS\Session */
protected $session;

public function setUp()
{
$client = new GuzzleHttp\Client;
$watcher = new Gsaulmon\GuzzleRecorder\GuzzleRecorder(__DIR__ . '/Fixtures/Http');
$client->getEmitter()->attach($watcher);
\PHRETS\Http\Client::set($client);

$config = new \PHRETS\Configuration;
$config->setLoginUrl('http://retsgw.flexmls.com/rets2_1/Login')
->setUsername(getenv('PHRETS_TESTING_USERNAME'))
->setPassword(getenv('PHRETS_TESTING_PASSWORD'))
->setRetsVersion('1.7.2');

$this->session = new PHRETS\Session($config);
$this->session->Login();
}
}
23 changes: 1 addition & 22 deletions tests/Integration/GetMetadataIntegrationTest.php
@@ -1,28 +1,7 @@
<?php

class GetMetadataIntegrationTest extends PHPUnit_Framework_TestCase
class GetMetadataIntegrationTest extends BaseIntegration
{
protected $client;
/** @var \PHRETS\Session */
protected $session;

public function setUp()
{
$client = new GuzzleHttp\Client;
$watcher = new Gsaulmon\GuzzleRecorder\GuzzleRecorder(__DIR__ . '/Fixtures/Http');
$client->getEmitter()->attach($watcher);
\PHRETS\Http\Client::set($client);

$config = new \PHRETS\Configuration;
$config->setLoginUrl('http://retsgw.flexmls.com/rets2_1/Login')
->setUsername(getenv('PHRETS_TESTING_USERNAME'))
->setPassword(getenv('PHRETS_TESTING_PASSWORD'))
->setRetsVersion('1.7.2');

$this->session = new PHRETS\Session($config);
$this->session->Login();
}

/**
* System
*/
Expand Down
23 changes: 1 addition & 22 deletions tests/Integration/GetObjectIntegrationTest.php
@@ -1,28 +1,7 @@
<?php

class GetObjectIntegrationTest extends PHPUnit_Framework_TestCase
class GetObjectIntegrationTest extends BaseIntegration
{
protected $client;
/** @var \PHRETS\Session */
protected $session;

public function setUp()
{
$client = new GuzzleHttp\Client;
$watcher = new Gsaulmon\GuzzleRecorder\GuzzleRecorder(__DIR__ . '/Fixtures/Http');
$client->getEmitter()->attach($watcher);
\PHRETS\Http\Client::set($client);

$config = new \PHRETS\Configuration;
$config->setLoginUrl('http://retsgw.flexmls.com/rets2_1/Login')
->setUsername(getenv('PHRETS_TESTING_USERNAME'))
->setPassword(getenv('PHRETS_TESTING_PASSWORD'))
->setRetsVersion('1.7.2');

$this->session = new PHRETS\Session($config);
$this->session->Login();
}

/** @test */
public function it_fetches_objects()
{
Expand Down
23 changes: 1 addition & 22 deletions tests/Integration/SessionIntegrationTest.php
@@ -1,28 +1,7 @@
<?php

class SessionIntegrationTest extends PHPUnit_Framework_TestCase
class SessionIntegrationTest extends BaseIntegration
{
protected $client;
/** @var \PHRETS\Session */
protected $session;

public function setUp()
{
$client = new GuzzleHttp\Client;
$watcher = new Gsaulmon\GuzzleRecorder\GuzzleRecorder(__DIR__ . '/Fixtures/Http');
$client->getEmitter()->attach($watcher);
\PHRETS\Http\Client::set($client);

$config = new \PHRETS\Configuration;
$config->setLoginUrl('http://retsgw.flexmls.com/rets2_1/Login')
->setUsername(getenv('PHRETS_TESTING_USERNAME'))
->setPassword(getenv('PHRETS_TESTING_PASSWORD'))
->setRetsVersion('1.7.2');

$this->session = new PHRETS\Session($config);
$this->session->Login();
}

/** @test * */
public function it_logs_in()
{
Expand Down
4 changes: 4 additions & 0 deletions tests/bootstrap.php
@@ -0,0 +1,4 @@
<?php

require_once(__DIR__ . "/../vendor/autoload.php");
require_once(__DIR__ . "/Integration/BaseIntegration.php");

0 comments on commit 33768aa

Please sign in to comment.