예제 #1
0
파일: logs.php 프로젝트: phangoapp/phasys
<?php

use PhangoApp\PhaModels\Webmodel;
use PhangoApp\PhaModels\CoreFields;
$log = new Webmodel('log_exec');
$log->register('father_pid', new CoreFields\IntegerField(), true);
$log->components['father_pid']->indexed = true;
$log->register('pid', new CoreFields\IntegerField(), true);
$log->register('command', new CoreFields\CharField());
$log->register('log', new CoreFields\SerializeField(new CoreFields\TextField()), true);
예제 #2
0
<?php

use PhangoApp\PhaModels\Webmodel;
use PhangoApp\PhaUtils\Utils;
use PhangoApp\PhaModels\CoreFields\CharField;
use PhangoApp\PhaModels\CoreFields\IntegerField;
include "../vendor/autoload.php";
Utils::load_config('config', '../settings');
$table_test = new Webmodel('table_test');
$table_test->register('name', new CharField(255));
$table_test->register('lastname', new CharField(255));
$table_test->register('type', new IntegerField());
$table_test->fields_to_update = ['name', 'lastname', 'type'];
class WebmodelTest extends PHPUnit_Framework_TestCase
{
    public function testCreateTable()
    {
        global $table_test;
        $this->assertTrue($table_test->create_table());
    }
    /**
     * @depends testCreateTable
     */
    public function testInsertRow()
    {
        global $table_test;
        $this->assertEquals(1, $table_test->insert(array('name' => 'Name', 'lastname' => 'LastName', 'type' => 1)));
    }
    /**
     * @depends testCreateTable
     * @depends testInsertRow