forked from phalcon/cphalcon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added structure for integration tests
- Loading branch information
Showing
18 changed files
with
2,052 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; | ||
SET time_zone = "+00:00"; | ||
|
||
CREATE DATABASE IF NOT EXISTS `phalcon_test` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; | ||
USE `phalcon_test`; | ||
|
||
DROP TABLE IF EXISTS `ph_select`; | ||
CREATE TABLE IF NOT EXISTS `ph_select` ( | ||
`sel_id` int(11) unsigned NOT NULL AUTO_INCREMENT, | ||
`sel_name` varchar(16) COLLATE utf8_unicode_ci NOT NULL, | ||
`sel_text` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, | ||
PRIMARY KEY (`sel_id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=9 ; | ||
|
||
INSERT INTO `ph_select` (`sel_id`, `sel_name`, `sel_text`) VALUES | ||
(1, 'Sun', 'The one and only'), | ||
(2, 'Mercury', 'Cold and hot'), | ||
(3, 'Venus', 'Yeah baby she''s got it'), | ||
(4, 'Earth', 'Home'), | ||
(5, 'Mars', 'The God of War'), | ||
(6, 'Jupiter', NULL), | ||
(7, 'Saturn', 'A car'), | ||
(8, 'Uranus', 'Loads of jokes for this one'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
namespace Codeception\Module; | ||
|
||
// here you can define custom actions | ||
// all public methods declared in helper class will be available in $I | ||
|
||
class IntegrationHelper extends \Codeception\Module | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<?php | ||
|
||
namespace PhalconTest; | ||
|
||
use \Phalcon\DI\FactoryDefault as PhDI; | ||
use \Phalcon\Config as PhConfig; | ||
use \Phalcon\Mvc\Url as PhUrl; | ||
use \Phalcon\Mvc\Router as PhRouter; | ||
use \Phalcon\Mvc\Dispatcher as PhDispatcher; | ||
use \Phalcon\Db\Adapter\Pdo\Mysql as PhMysql; | ||
use \Phalcon\Loader as PhLoader; | ||
use \Phalcon\Mvc\Application as PhApplication; | ||
|
||
$di = new PhDI(); | ||
|
||
/** | ||
* Config file | ||
*/ | ||
$configFile = require(ROOT_PATH . '/_support/_config/global.php'); | ||
$di->set( | ||
'config', | ||
function () use ($configFile) { | ||
return new PhConfig($configFile); | ||
}, | ||
true | ||
); | ||
|
||
/** | ||
* Autoloader | ||
*/ | ||
$di->set( | ||
'loader', | ||
function () use ($di) { | ||
|
||
$config = $di['config']; | ||
$loader = new PhLoader(); | ||
|
||
$loader->registerDirs( | ||
[$config->app_path->dirs] | ||
); | ||
|
||
// Register the Library namespace as well as the common module | ||
// since it needs to always be available | ||
$loader->registerNamespaces( | ||
['PhalconTest\Models' => $config->app_path->models] | ||
); | ||
|
||
$loader->register(); | ||
} | ||
); | ||
|
||
/** | ||
* The URL component is used to generate all kind of urls in the | ||
* application | ||
*/ | ||
$di->set( | ||
'url', | ||
function () use ($di) { | ||
|
||
$config = $di['config']; | ||
|
||
$url = new PhUrl(); | ||
$url->setBaseUri($config->app_baseUri); | ||
|
||
return $url; | ||
}, | ||
true | ||
); | ||
|
||
/** | ||
* Router | ||
*/ | ||
$di->set( | ||
'router', | ||
function () { | ||
|
||
$router = new PhRouter(false); | ||
return $router; | ||
}, | ||
true | ||
); | ||
|
||
/** | ||
* Dispatcher | ||
*/ | ||
$di->set( | ||
'dispatcher', | ||
function () use ($di) { | ||
$dispatcher = new PhDispatcher(); | ||
return $dispatcher; | ||
} | ||
); | ||
|
||
/** | ||
* Db | ||
*/ | ||
$di->set( | ||
'db', | ||
function () use ($di) { | ||
|
||
$config = $di['config']; | ||
|
||
$params = [ | ||
"host" => $config->app_db_test->host, | ||
"username" => $config->app_db_test->username, | ||
"password" => $config->app_db_test->password, | ||
"dbname" => $config->app_db_test->dbname, | ||
"charset" => $config->app_db_test->charset, | ||
]; | ||
|
||
$adapter = $config->app_db_test->adapter; | ||
$conn = new $adapter(); | ||
|
||
// Set everything to UTF8 | ||
$conn->execute('SET NAMES UTF8', []); | ||
|
||
return $conn; | ||
} | ||
); | ||
|
||
$application = new PhApplication(); | ||
$application->setDI($di); | ||
|
||
PhDI::setDefault($di); | ||
|
||
return $application; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
$base = [ | ||
'app_baseUri' => '/', | ||
'app_timezone' => 'UTC', | ||
'app_db_test' => [ | ||
'adapter' => 'Mysql', | ||
'host' => 'localhost', | ||
'username' => 'root', | ||
'password' => '1234', | ||
'name' => 'phalcon_test', | ||
'charset' => 'utf-8', | ||
], | ||
]; | ||
|
||
$path = [ | ||
'app_path' => [ | ||
'dirs' => ROOT_PATH . '/_support/', | ||
'models' => ROOT_PATH . '/_support/_models/', | ||
] | ||
]; | ||
|
||
return array_merge( | ||
$base, | ||
$path | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
/** | ||
* Select.php | ||
* \PhalconTest\Models\Select | ||
* | ||
* Select model class | ||
* | ||
* PhalconPHP Framework | ||
* | ||
* @copyright (c) 2011-2014 Phalcon Team | ||
* @link http://www.phalconphp.com | ||
* @author Andres Gutierrez <andres@phalconphp.com> | ||
* @author Nikolaos Dimopoulos <nikos@phalconphp.com> | ||
* | ||
* The contents of this file are subject to the New BSD License that is | ||
* bundled with this package in the file docs/LICENSE.txt | ||
* | ||
* If you did not receive a copy of the license and are unable to obtain it | ||
* through the world-wide-web, please send an email to license@phalconphp.com | ||
* so that we can send you a copy immediately. | ||
*/ | ||
|
||
namespace PhalconTest\Models; | ||
|
||
use \Phalcon\Mvc\Model as PhModel; | ||
|
||
class Select extends PhModel | ||
{ | ||
public function initialize() | ||
{ | ||
} | ||
|
||
public function getSource() | ||
{ | ||
return 'ph_select'; | ||
} | ||
|
||
public function getId() | ||
{ | ||
return $this->sel_id; | ||
} | ||
|
||
public function getName() | ||
{ | ||
return $this->sel_name; | ||
} | ||
|
||
public function getText() | ||
{ | ||
return $this->sel_text; | ||
} | ||
|
||
public function setId($id) | ||
{ | ||
$this->sel_id = $id; | ||
} | ||
|
||
public function setName($name) | ||
{ | ||
$this->sel_name = $name; | ||
} | ||
|
||
public function setText($text) | ||
{ | ||
$this->sel_text = $text; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class_name: IntegrationTester | ||
modules: | ||
enabled: [IntegrationHelper, Phalcon1] | ||
config: | ||
Phalcon1: | ||
bootstrap: '/tests/_support/_config/bootstrap.php' |
Oops, something went wrong.