public function testCodeceptionWithInvalidExecutable()
 {
     $config = (require dirname(__FILE__) . '/../_config/codeception_executable_fail.php');
     $site = new \App\Lib\Site($this->config['sites']);
     $site->set(md5($this->site_name));
     $codeception = new \App\Lib\Codeception($config, $site);
     $response = $codeception->checkExecutable($config['executable'], $config['location']);
     $this->assertFalse($response['ready']);
 }
Пример #2
0
|--------------------------------------------------------------------------
*/
$app->container->singleton('site', function () use($app, $config) {
    $hash_in_querystring = $app->request()->get('hash');
    // If the site is being changed (via query string), use that.
    // If a site is in session, use that.
    // Otherwise, set as false and the Site() class will pull the first site it can find.
    $hash = FALSE;
    if (!is_null($hash_in_querystring) && $hash_in_querystring !== FALSE) {
        $hash = $hash_in_querystring;
    } elseif (isset($_SESSION[HASH])) {
        $hash = $_SESSION[HASH];
    }
    // Setup the site class with all the available sites from the
    // Codeception configuration
    $site = new \App\Lib\Site($config['sites']);
    // Set the current site
    $site->set($hash);
    // Update the users session to use the chosen site
    $_SESSION[HASH] = $site->getHash();
    return $site;
});
/*
|--------------------------------------------------------------------------
| Codeception Class
|--------------------------------------------------------------------------
*/
$app->container->singleton('codeception', function () use($config, $app) {
    return new \App\Lib\Codeception($config, $app->site);
});
/*
Пример #3
0
 public function testSettingSingleValidSites()
 {
     $sites = $this->config['sites'];
     // Remove the first site
     unset($sites[$this->site_1]);
     $site = new \App\Lib\Site($sites);
     $filtered = $site->prepare($this->single_site);
     // Confirm the single set has been set
     $this->assertEquals($filtered, $site->getSites());
     $this->assertEquals(count($site->getSites()), 1);
     $this->assertFalse($site->hasChoices());
     $this->assertFalse($site->ready());
     // Set to first site.
     $site->set($this->hash_2);
     $this->assertTrue($site->ready());
     $this->assertEquals($site->getName(), $this->site_2);
     $this->assertEquals($this->hash_2, $site->getHash());
     $this->assertEquals($filtered[$this->hash_2]['path'], $site->getConfig());
     $this->assertEquals(basename($filtered[$this->hash_2]['path']), $site->getConfigFile());
     $this->assertEquals(dirname($filtered[$this->hash_2]['path']) . '/', $site->getConfigPath());
     // Check there's only one site but we don't have choices
     $this->assertEquals(count($site->getSites()), 1);
     $this->assertFalse($site->hasChoices());
 }