当前位置: 首页>>代码示例>>PHP>>正文


PHP Test::table方法代码示例

本文整理汇总了PHP中Test::table方法的典型用法代码示例。如果您正苦于以下问题:PHP Test::table方法的具体用法?PHP Test::table怎么用?PHP Test::table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Test的用法示例。


在下文中一共展示了Test::table方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testTable

 function testTable()
 {
     $tb = Test::table();
     $new_data = ['nickname' => 'z3'];
     $tb->insert($new_data);
     $this->assertEquals(1, $tb->count());
     $this->assertEquals([['nickname' => 'z3']], $tb->selectData());
     $update = $tb->update(['nickname' => 'w5']);
     $this->assertEquals(1, $update);
     $this->assertEquals([['nickname' => 'w5']], $tb->selectData());
     $tb_new = clone $tb;
     $tb_new->where('nickname=%s', 'w5');
     //$this->assertEquals('SELEC', $tb->buildSelect());
     $this->assertEquals([['nickname' => 'w5']], $tb_new->selectData());
     $tb_new->clearWhere();
     $tb_new->andWhere(['nickname' => 'w5']);
     //$this->assertEquals('SELEC', $tb->buildSelect());
     $this->assertEquals([['nickname' => 'w5']], $tb_new->selectData());
     $this->assertEquals(1, $tb_new->update(['nickname' => 'z3']));
     $this->assertEquals([['nickname' => 'z3']], $tb->selectData());
     $obj_list = $tb->select();
     $obj = $obj_list[0];
     /* @var $obj Test */
     $this->assertEquals('z3', $obj->nickname);
     $tb->delete();
     $test = new Test();
     $test->nickname = 'hehe';
     $this->assertEquals(TRUE, $test->save());
     $this->assertEquals('hehe', Test::table()->selectData()[0]['nickname']);
     $test->delete();
     $this->assertEquals([], $tb->selectData());
     $this->assertEquals('SELECT * FROM test Test', $tb->buildSelect());
     $this->assertEquals('SELECT * FROM test Test LIMIT 10', $tb->buildSelect(10));
     $this->assertEquals('SELECT * FROM test Test LIMIT 10 OFFSET 10', $tb->buildSelect(10, 10));
 }
开发者ID:kasonyang,项目名称:hitar,代码行数:35,代码来源:TableTest.php

示例2: init

function init()
{
    $tb = Test::table();
    $sm = $tb->getConnection()->getSchemaManager();
    $schema = $sm->createSchema();
    $new_tb = $schema->createTable('test');
    $new_tb->addColumn('nickname', 'string', ['length' => 100]);
    $new_tb2 = $schema->createTable('tableexample');
    $new_tb2->addColumn('id', 'string', ['length' => 100]);
    $new_tb2->addColumn('name', 'string', ['length' => 100]);
    $sqls = $schema->toSql($tb->getConnection()->getDatabasePlatform());
    foreach ($sqls as $q) {
        $tb->getConnection()->exec($q);
    }
}
开发者ID:kasonyang,项目名称:hitar,代码行数:15,代码来源:initTest.php

示例3: testRecord

 function testRecord()
 {
     $this->assertEquals('test', Test::table()->getTableName());
     $this->assertEquals('Test', Test::table()->getTableAliasName());
 }
开发者ID:kasonyang,项目名称:hitar,代码行数:5,代码来源:RecordTest.php


注:本文中的Test::table方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。