private function fixPath()
    {
        $file = $this->app_dir.'/'.$this->test_dir.'/Bootstrap.php';
        $contents = file_get_contents($file);

        if (! file_exists('system')) {
            if (file_exists('vendor/codeigniter/framework/system')) {
                $contents = str_replace(
                    '$system_path = \'../../system\';',
                    '$system_path = \'../../vendor/codeigniter/framework/system\';',
                    $contents
                );
            } else {
                throw new Exception('Can\'t find "system" folder.');
            }
        }

        if (! file_exists('index.php')) {
            if (file_exists($this->pub_dir.'/index.php')) {
                // CodeIgniter 3.0.6 and after
                $contents = str_replace(
                    "define('FCPATH', realpath(dirname(__FILE__).'/../..').DIRECTORY_SEPARATOR);",
                    "define('FCPATH', realpath(dirname(__FILE__).'/../../{$this->pub_dir}').DIRECTORY_SEPARATOR);",
                    $contents
                );
                // CodeIgniter 3.0.5 and before
                $contents = str_replace(
                    "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');",
                    "define('FCPATH', realpath(dirname(__FILE__).'/../../{$this->pub_dir}').'/');",
                    $contents
                );
            } elseif (file_exists($this->app_dir.'/public/index.php')) {
                // CodeIgniter 3.0.6 and after
                $contents = str_replace(
                    "define('FCPATH', realpath(dirname(__FILE__).'/../..').DIRECTORY_SEPARATOR);",
                    "define('FCPATH', realpath(dirname(__FILE__).'/../public').DIRECTORY_SEPARATOR);",
                    $contents
                );
                // CodeIgniter 3.0.5 and before
                $contents = str_replace(
                    "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');",
                    "define('FCPATH', realpath(dirname(__FILE__).'/../public').'/');",
                    $contents
                );
                if ($this->app_dir !== 'application') {
                    $contents = str_replace(
                        "\$application_folder = '../../application';",
                        "\$application_folder = '../../{$this->app_dir}';",
                        $contents
                    );
                }
            } else {
                throw new Exception('Can\'t find "index.php".');
            }
        }

        file_put_contents($file, $contents);
    }