protected function setUp()
 {
     $this->module = new \Codeception\Module\PhpBrowser();
     $url = 'http://localhost:8000';
     $this->module->_setConfig(array('url' => $url));
     $this->module->_initialize();
     $this->module->_cleanup();
     $this->module->_before($this->makeTest());
     $this->history = new \GuzzleHttp\Subscriber\History();
     $this->module->guzzle->getEmitter()->attach($this->history);
 }
 public function setUp()
 {
     $this->phpBrowser = new \Codeception\Module\PhpBrowser();
     $url = 'http://localhost:8010';
     $this->phpBrowser->_setConfig(array('url' => $url));
     $this->phpBrowser->_initialize();
     $this->module = Stub::make('\\Codeception\\Module\\REST', ['getModules' => [$this->phpBrowser]]);
     $this->module->_initialize();
     $this->module->_before(Stub::makeEmpty('\\Codeception\\TestCase\\Cest'));
     $this->phpBrowser->_before(Stub::makeEmpty('\\Codeception\\TestCase\\Cest'));
 }
    public function setUp() {
        $this->phpBrowser = new \Codeception\Module\PhpBrowser();
        $url = 'http://localhost:8010';
        $this->phpBrowser->_setConfig(array('url' => $url));
        $this->phpBrowser->_initialize();
        $this->phpBrowser->_before(Stub::makeEmpty('\Codeception\TestCase\Cest'));

        $this->module = new \Codeception\Module\REST();
        $this->module->_initialize();
        $this->module->client = $this->phpBrowser->client;
        $this->module->_before(Stub::makeEmpty('\Codeception\TestCase\Cest'));

    }
    protected function setUp() {
        $this->noPhpWebserver();
        $this->module = new \Codeception\Module\PhpBrowser();
        $url = '';
        if (version_compare(PHP_VERSION, '5.4', '>=')) $url = 'http://localhost:8000';
        // my local config.
        if ($this->is_local) $url = 'http://testapp.com';

        $this->module->_setConfig(array('url' => $url));
        $this->module->_initialize();
        $this->module->_cleanup();
        $this->module->_before($this->makeTest());
    }
Esempio n. 5
0
 protected function setUp()
 {
     $this->module = new \Codeception\Module\PhpBrowser(make_container());
     $url = 'http://localhost:8000';
     $this->module->_setConfig(array('url' => $url));
     $this->module->_initialize();
     $this->module->_cleanup();
     $this->module->_before($this->makeTest());
     if (class_exists('GuzzleHttp\\Url')) {
         $this->history = new \GuzzleHttp\Subscriber\History();
         $this->module->guzzle->getEmitter()->attach($this->history);
     } else {
         $this->module->guzzle->getConfig('handler')->push(\GuzzleHttp\Middleware::history($this->history));
     }
 }
Esempio n. 6
0
 public function testLoginToFacebook()
 {
     $this->markTestSkipped();
     // preconditions: #1 php web server being run
     $browserModule = new PhpBrowser();
     $browserModule->_setConfig(array('url' => 'http://localhost:8000'));
     $browserModule->_initialize();
     $browserModule->_cleanup();
     $browserModule->_before($this->makeTest());
     SuiteManager::$modules['PhpBrowser'] = $browserModule;
     // preconditions: #2 facebook test user was created
     $this->module->haveFacebookTestUserAccount();
     $testUserFirstName = $this->module->grabFacebookTestUserFirstName();
     // preconditions: #3 test user logged in on facebook
     $this->module->haveTestUserLoggedInOnFacebook();
     // go to our page with facebook login button
     $browserModule->amOnPage('/facebook');
     // check that yet we are not logged in with facebook
     $browserModule->see('You are not Connected.');
     // click on "Login with Facebook" button to start login with facebook
     $browserModule->click('Login with Facebook');
     // check that we are logged in with facebook
     $browserModule->see('Your User Object (/me)');
     $browserModule->see($testUserFirstName);
     // cleanup
     unset(SuiteManager::$modules['PhpBrowser']);
     $browserModule->_after($this->makeTest());
     data::clean();
 }
Esempio n. 7
0
 public function setUp()
 {
     $this->noPhpWebserver();
     $this->module = new \Codeception\Module\PhpBrowser();
     $url = '';
     if (strpos(PHP_VERSION, '5.4') === 0) {
         $url = 'http://localhost:8000';
     }
     // my local config.
     if ($this->is_local) {
         $url = 'http://testapp.com';
     }
     $this->module->_setConfig(array('url' => $url));
     $this->module->_initialize();
     $this->module->_cleanup();
     $this->module->_before($this->makeTest());
 }
Esempio n. 8
0
 /**
  * @Issue https://github.com/Codeception/Codeception/issues/2075
  * Client is undefined for the second test
  */
 public function testTwoTests()
 {
     $cest1 = Stub::makeEmpty('\\Codeception\\TestCase\\Cest');
     $cest2 = Stub::makeEmpty('\\Codeception\\TestCase\\Cest');
     $this->module->sendGET('/rest/user/');
     $this->module->seeResponseIsJson();
     $this->module->seeResponseContains('davert');
     $this->module->seeResponseContainsJson(array('name' => 'davert'));
     $this->module->seeResponseCodeIs(200);
     $this->module->dontSeeResponseCodeIs(404);
     $this->phpBrowser->_after($cest1);
     $this->module->_after($cest1);
     $this->module->_before($cest2);
     $this->phpBrowser->_before($cest2);
     $this->module->sendGET('/rest/user/');
     $this->module->seeResponseIsJson();
     $this->module->seeResponseContains('davert');
     $this->module->seeResponseContainsJson(array('name' => 'davert'));
     $this->module->seeResponseCodeIs(200);
     $this->module->dontSeeResponseCodeIs(404);
 }
 private function initModule(PhpBrowser $browserModule, array $params)
 {
     $browserModule->_setConfig($params);
     $browserModule->_initialize();
     $browserModule->_cleanup();
     $browserModule->_before($this->makeTest());
 }