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(make_container());
     $url = 'http://localhost:8010';
     $this->phpBrowser->_setConfig(array('url' => $url));
     $this->phpBrowser->_initialize();
     $this->module = Stub::make('\\Codeception\\Module\\REST');
     $this->module->_inject($this->phpBrowser);
     $this->module->_initialize();
     $this->module->_before(Stub::makeEmpty('\\Codeception\\Test\\Cest'));
     $this->phpBrowser->_before(Stub::makeEmpty('\\Codeception\\Test\\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());
    }
Beispiel #5
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();
 }
Beispiel #6
0
 /**
  * Initializes the module setting the properties values.
  * @return void
  */
 public function _initialize()
 {
     parent::_initialize();
     $this->loginUrl = str_replace('wp-admin', 'wp-login.php', $this->config['adminUrl']);
     $this->adminUrl = rtrim($this->config['adminUrl'], '/');
     $this->pluginsUrl = $this->adminUrl . '/plugins.php';
 }
Beispiel #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());
 }
Beispiel #8
0
 /**
  * Initializes the module setting the properties values.
  * @return void
  */
 public function _initialize()
 {
     parent::_initialize();
     $this->configBackCompat();
     $adminPath = $this->config['adminPath'];
     $this->loginUrl = str_replace('wp-admin', 'wp-login.php', $adminPath);
     $this->adminPath = rtrim($adminPath, '/');
     $this->pluginsPath = $this->adminPath . '/plugins.php';
 }
Beispiel #9
0
 public function testCurlOptions()
 {
     $this->skipForOldGuzzle();
     $this->module->_setConfig(array('url' => 'http://google.com', 'curl' => array('CURLOPT_NOBODY' => true)));
     $this->module->_initialize();
     $config = $this->module->guzzle->getConfig('config');
     $this->assertArrayHasKey('curl', $config);
     $this->assertArrayHasKey('CURLOPT_NOBODY', $config['curl']);
 }
 public function testCurlOptions()
 {
     $this->module->_setConfig(array('url' => 'http://google.com', 'curl' => array('CURLOPT_NOBODY' => true)));
     $this->module->_initialize();
     if (method_exists($this->module->guzzle, 'getConfig')) {
         $config = $this->module->guzzle->getConfig('config');
     } else {
         $config = $this->module->guzzle->getDefaultOption('config');
     }
     $this->assertArrayHasKey('curl', $config);
     $this->assertArrayHasKey('CURLOPT_NOBODY', $config['curl']);
 }
Beispiel #11
0
 public function testCurlSslOptions()
 {
     $this->module->_setConfig(array('url' => 'https://google.com', 'curl' => array('CURLOPT_NOBODY' => true, 'CURLOPT_SSL_CIPHER_LIST' => 'TLSv1')));
     $this->module->_initialize();
     if (method_exists($this->module->guzzle, 'getConfig')) {
         $config = $this->module->guzzle->getConfig();
     } else {
         $config = $this->module->guzzle->getDefaultOption('config');
     }
     $this->assertArrayHasKey('curl', $config);
     $this->assertArrayHasKey(CURLOPT_SSL_CIPHER_LIST, $config['curl']);
     $this->module->amOnPage('/');
     $this->assertSame('', $this->module->_getResponseContent(), 'CURLOPT_NOBODY setting is not respected');
 }
 public function testCurlOptions()
 {
     $this->module->_setConfig(array('url' => 'http://google.com', 'curl' => array('CURLOPT_NOBODY' => true)));
     $this->module->_initialize();
     $this->assertTrue($this->module->guzzle->getDefaultOption('config/curl/' . CURLOPT_NOBODY));
 }
Beispiel #13
0
 public function testSeeCheckboxChecked()
 {
     $this->module->_initialize();
     $this->module->amOnPage('/info');
     $this->module->seeCheckboxIsChecked('input[type=checkbox]');
 }
 private function initModule(PhpBrowser $browserModule, array $params)
 {
     $browserModule->_setConfig($params);
     $browserModule->_initialize();
     $browserModule->_cleanup();
     $browserModule->_before($this->makeTest());
 }