Permalink
Browse files

bump

  • Loading branch information...
1 parent ead0b74 commit 813bfabb978a879e9248cd06c91c58cfb81bd434 @romaninsh romaninsh committed Dec 26, 2011
Showing with 130 additions and 11 deletions.
  1. +1 −1 atk4
  2. +2 −2 lib/Frontend.php
  3. +3 −2 page/crud.php
  4. +1 −1 page/db3.php
  5. +120 −3 page/db4.php
  6. +1 −1 page/dbparam.php
  7. +1 −0 page/dbwhere.php
  8. +1 −1 page/modelrel.php
View
@@ -13,15 +13,15 @@ function set($name,$descr){
}
}
-class Model_Examples extends Model_Array {
+class Model_Examples extends Model {
public $dir;
function init(){
parent::init();
$this->addField('name');
$p=$this->api->pathfinder->searchDir('page');
- $this->setAssoc($p);
+ $this->setSource('ArrayAssoc',$p);
return $this;
}
View
@@ -3,8 +3,9 @@ class page_crud extends Page {
function init(){
parent::init();
//phpinfo();
- $this->api->db=$this->api->add('DB');
+ $this->api->db=$this->api->add('DB')->connect();
$model = $this->add('CRUD')->setModel('MyModel');
+ $model->debug();
}
}
@@ -20,7 +21,7 @@ function init(){
}
}
class Model_MyModel extends Model_Table {
- public $entity_code='user';
+ public $table='user';
function init(){
parent::init();
View
@@ -83,7 +83,7 @@ class page_db3 extends Page_Tester {
)
);
function init(){
- $this->db=$this->add('DB');
+ $this->db=$this->add('DB')->connect();
$this->add('View_Info')->set('Testing basic rendering functionality');
parent::init();
}
View
@@ -2,18 +2,103 @@
class page_db4 extends Page_Tester {
public $db;
+ public $proper_responses=array(
+ "Test_combi"=>array (
+ 0 => 'select * from `book` where `id` = :a => update `book` set `name`=:a where `id` = :a_2',
+ 1 =>
+ array (
+ ':a' => 'Foo',
+ ':a_2' => 1,
+ ),
+),
+ "Test_join1"=>array (
+ 0 => 'select * from `user` ',
+ 1 =>
+ array (
+ ),
+),
+ "Test_join2"=>array (
+ 0 => 'select * from `user` left join `address` on `address`.`id` = `user`.`address_id` ',
+ 1 =>
+ array (
+ ),
+),
+ "Test_join3"=>array (
+ 0 => 'select * from `user` left join `address` on `address`.`user_id` = `user`.`id` ',
+ 1 =>
+ array (
+ ),
+),
+ "Test_join4"=>array (
+ 0 => 'select * from `user` inner join `address` on `address`.`code` = `user`.`code` ',
+ 1 =>
+ array (
+ ),
+),
+ "Test_join5"=>array (
+ 0 => 'select * from `user` left join `address` on `address`.`id` = `user`.`address_id` left join `portfolio` on `portfolio`.`id` = `user`.`portfolio_id` ',
+ 1 =>
+ array (
+ ),
+),
+ "Test_join6"=>array (
+ 0 => 'select * from `user` left join `address` as `a` on `a`.`id` = `user`.`address_id` left join `portfolio` as `p` on `p`.`id` = `user`.`portfolio_id` ',
+ 1 =>
+ array (
+ ),
+),
+ "Test_call"=>array (
+ 0 => 'call myfunc(:a, :a_2, :a_3)',
+ 1 =>
+ array (
+ ':a' => '1',
+ ':a_2' => 'test,def',
+ ':a_3' => 'abc',
+ ),
+),
+ "Test_group"=>array (
+ 0 => 'select `name`,count(*) from `user` group by `name`, `surname` ',
+ 1 =>
+ array (
+ ),
+),
+ "Test_order"=>array (
+ 0 => 'select * from `user` order by `name`, `surname` ',
+ 1 =>
+ array (
+ ),
+),
+ "Test_order2"=>array (
+ 0 => 'select * from `user` order by `name`, `surname` ',
+ 1 =>
+ array (
+ ),
+),
+ "Test_limit"=>array (
+ 0 => 'select * from `user` limit :a, :a_2',
+ 1 =>
+ array (
+ ':a' => 0,
+ ':a_2' => 0,
+ ),
+)
+ );
function init(){
- $this->db=$this->add('DB');
+ $this->db=$this->add('DB')->connect();
$this->add('View_Info')->set('Testing basic rendering functionality');
parent::init();
}
+ function runTests(){
+ $this->grid->addColumn('text','Test_para');
+ return parent::runTests();
+ }
function prepare(){
return array($this->db->dsql());
}
function formatResult(&$row,$key,$result){
//parent::formatResult($row,$key,$result);
$x=parent::formatResult($row,$key,$result);
- if($this->input[0]->params)$row[$key.'_para']=print_r($this->input[0]->params,true);
+ $row[$key.'_para']=var_export($this->input[0]->params,true);
return array($x,$this->input[0]->params);
}
function test_combi($t){
@@ -23,8 +108,40 @@ function test_combi($t){
function test_join1($t){
return $t->table('user');
}
- function test_render2($t){
+ function test_join2($t){
return $t->table('user')->join('address');
}
+ function test_join3($t){
+ return $t->table('user')->join('address.user_id');
+ }
+ function test_join4($t){
+ return $t->table('user')->join('address.code','code','inner');
+ }
+ function test_join5($t){
+ return $t->table('user')
+ ->join('address')
+ ->join('portfolio');
+ }
+ function test_join6($t){
+ return $t->table('user')->join(array('a'=>'address','p'=>'portfolio'));
+ }
+ function test_call($t){
+ return $t->call('myfunc',array('1','test,def','abc'));
+ }
+ function test_group($t){
+ return $t->table('user')->field('name,count(*)')->group('name,surname');
+ }
+ function test_order($t){
+ return $t->table('user')->order('name,surname');
+ }
+ function test_order2($t){
+ return $t->table('user')->order('name')->order('surname');
+ }
+ function test_limit($t){
+ return $t->table('user')->limit(5);
+ }
+ function test_insert($t){
+ return $t->table('user')->set('foo',123)->insert();
+ }
}
View
@@ -81,7 +81,7 @@ class page_dbparam extends Page_Tester {
);
function init(){
- $this->db=$this->add('DB');
+ $this->db=$this->add('DB')->connect();
$this->add('View_Info')->set('Subqueries parametric arguments must not clash with the main query. To avoid
$dsql->dsql() should be used or unique paramBase()');
parent::init();
View
@@ -176,6 +176,7 @@ class page_dbwhere extends Page_Tester {
);
function init(){
$this->db=$this->add('DB');
+ $this->db->connect();
parent::init();
}
function runTests(){
View
@@ -8,7 +8,7 @@ function init(){
}
function prepare(){
$m=$this->add('Model_Table');
- $m->entity_code='user';
+ $m->table='user';
$m->addField('name');
$m->addField('age')->calculated(function(){
return 'length(name)';

0 comments on commit 813bfab

Please sign in to comment.