コード例 #1
0
ファイル: QueryTest.php プロジェクト: nicarayz/linabiz
 /**
  * @see Gas\Core   (./classes/core.php)
  * @see Model\User (./tests/dummyModels/user.php)
  * @see Model\Wife (./tests/dummyModels/wife.php)
  */
 public function setUp()
 {
     // Prepare some table(s) for test,
     // and connect using related environment
     Model\User::setUp();
     Model\Wife::setUp();
     $this->db = Gas\Core::$db;
 }
コード例 #2
0
ファイル: FinderTest.php プロジェクト: nicarayz/linabiz
 /**
  * @see Model\User      (./tests/dummyModels/user.php)
  * @see Model\Wife      (./tests/dummyModels/wife.php)
  * @see Model\Kid       (./tests/dummyModels/kid.php)
  * @see Model\Job       (./tests/dummyModels/job.php)
  */
 public function setUp()
 {
     Model\User::setUp();
     Model\Wife::setUp();
     Model\Kid::setUp();
     Model\Job::setUp();
     Model\Job\User::setUp();
 }
コード例 #3
0
ファイル: FindTest.php プロジェクト: nicarayz/linabiz
 public function testFindSeveral()
 {
     $wifes = Model\Wife::find(1, 2, 3);
     // Should be an array, contain 3 wife objects
     $this->assertCount(3, $wifes);
     foreach ($wifes as $wife) {
         // Consist
         $this->assertInstanceOf('Gas\\ORM', $wife);
         $this->assertInstanceOf('Gas\\Data', $wife->record);
         // Check results
         switch ($wife->id) {
             case '1':
                 $this->assertEquals($wife->name, 'Lourie Jones');
                 break;
             case '2':
                 $this->assertEquals($wife->name, 'Patricia Doe');
                 break;
             case '3':
                 $this->assertEquals($wife->name, 'Lily Sinatra');
                 break;
         }
     }
 }
コード例 #4
0
ファイル: EagerLoadTest.php プロジェクト: nicarayz/linabiz
 public function testEagerLoadBelongsToSimpleOne()
 {
     // Find wife with id `1`
     $wife1 = Model\Wife::with('user')->find(1);
     // Consist
     $this->assertInstanceOf('Gas\\ORM', $wife1);
     $this->assertInstanceOf('Gas\\Data', $wife1->record);
     // Check result
     $this->assertEquals($wife1->id, '1');
     $this->assertEquals($wife1->name, 'Lourie Jones');
     $this->assertEquals($wife1->hair_color, 'black');
     // Grab related husband (user)
     $wife1_husband = $wife1->user();
     // Consist
     $this->assertInstanceOf('Gas\\ORM', $wife1_husband);
     $this->assertInstanceOf('Gas\\Data', $wife1_husband->record);
     // Check results, this should be `Derek Jones` with `2` as his id
     // `derekjones@world.com` as his email and `derek` as his username
     $this->assertEquals($wife1_husband->id, '2');
     $this->assertEquals($wife1_husband->name, 'Derek Jones');
     $this->assertEquals($wife1_husband->email, '*****@*****.**');
     $this->assertEquals($wife1_husband->username, 'derek');
 }
コード例 #5
0
 /**
  * @see Model\User (./tests/dummyModels/user.php)
  * @see Model\Wife (./tests/dummyModels/wife.php)
  */
 public function setUp()
 {
     Model\User::setUp();
     Model\Wife::setUp();
 }
コード例 #6
0
ファイル: bootstrap.php プロジェクト: nicarayz/linabiz
$gasdir = implode(DIRECTORY_SEPARATOR, $fragdir);
// Catch Base Directory
if (defined('ROOTPATH')) {
    array_splice($fragdir, -2);
} else {
    array_splice($fragdir, -3);
}
$basedir = implode(DIRECTORY_SEPARATOR, $fragdir);
// Define the PATH and ENVIRONMENT
define('ENVIRONMENT', 'testing');
if (defined('ROOTPATH')) {
    define('APPPATH', $basedir . DIRECTORY_SEPARATOR);
    define('BASEPATH', APPPATH . 'vendor' . DIRECTORY_SEPARATOR . 'CodeIgniter' . DIRECTORY_SEPARATOR . 'system' . DIRECTORY_SEPARATOR);
} else {
    define('APPPATH', $basedir . DIRECTORY_SEPARATOR . 'application' . DIRECTORY_SEPARATOR);
    define('BASEPATH', $basedir . DIRECTORY_SEPARATOR . 'system' . DIRECTORY_SEPARATOR);
}
// Define Gas ORM configuration for unit testing
$config = array('models_path' => array('Model' => __DIR__ . DIRECTORY_SEPARATOR . 'dummyModels'), 'cache_request' => FALSE, 'auto_create_models' => FALSE, 'auto_create_tables' => FALSE);
// Include Gas ORM configuration and Bootstrap
include_once $gasdir . DIRECTORY_SEPARATOR . 'bootstrap.php';
// Initialize all Model's setup
Model\Job\User::setUp();
Model\Role\User::setUp();
Model\Job::setUp();
Model\Kid::setUp();
Model\Role::setUp();
Model\User::setUp();
Model\Wife::setUp();
// Reconnect
Gas\Core::connect(DB_GROUP);