Skip to content

Instantly share code, notes, and snippets.

@NickBusey
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickBusey/4b309eb0c066fa8cd805 to your computer and use it in GitHub Desktop.
Save NickBusey/4b309eb0c066fa8cd805 to your computer and use it in GitHub Desktop.
<?php
App::uses('AppModel', 'Model');
/**
* Device Model
*
* @property Raw $Raw
*/
class Device extends AppModel {
/**
* Use database config
*
* @var string
*/
public $useDbConfig = 'data';
/**
* Use table
*
* @var mixed False or table name
*/
public $useTable = 'device';
/**
* Display field
*
* @var string
*/
public $displayField = 'id';
public $actsAs = array(
'AuditLog.Auditable',
'SoftDelete',
);
}
<?php
/**
* DeviceFixture
*
*/
class DeviceFixture extends CakeTestFixture {
/**
* Table name
*
* @var string
*/
public $table = 'device';
/**
* Import
*
* @var array
*/
public $import = array('model' => 'Device', 'connection' => 'data');
/**
* Records
*
* @var array
*/
public $records = array(
array(
'id' => '1',
'type' => '1',
'mac' => '90-A2-DA-0F-B5-86',
'ip' => '192.168.1.177',
'created' => '2014-12-16 20:58:37',
'modified' => '2015-01-05 13:42:58',
'last_message' => '2015-01-16 12:04:54',
'status' => '0'
),
array(
'id' => '2',
'type' => '2',
'mac' => '90-A2-DA-0F-B5-88',
'ip' => '192.168.1.179',
'created' => '2014-12-16 21:15:38',
'modified' => '2014-12-16 21:15:38',
'last_message' => '2015-01-19 15:17:07',
'status' => '1'
),
array(
'id' => '3',
'type' => '1',
'mac' => '',
'ip' => '',
'created' => '2015-01-09 12:24:19',
'modified' => '2015-01-09 12:24:30',
'last_message' => '2015-01-19 19:48:31',
'status' => '1'
),
array(
'id' => '4',
'type' => '4',
'mac' => '',
'ip' => '',
'created' => '2015-01-16 12:11:20',
'modified' => '2015-01-16 12:11:20',
'last_message' => '2015-01-16 15:02:09',
'status' => '1'
),
array(
'id' => '5',
'type' => '1',
'mac' => '',
'ip' => '',
'created' => '2015-01-19 15:17:28',
'modified' => '2015-01-19 15:18:51',
'last_message' => '2015-01-19 16:03:06',
'status' => '1'
),
array(
'id' => '6',
'type' => '0',
'mac' => '',
'ip' => '',
'created' => '2015-01-20 02:03:48',
'modified' => '2015-01-20 02:03:48',
'last_message' => null,
'status' => '0'
),
);
}
<?php
class DeviceTest extends ControllerTestCase {
public $fixtures = array(
'app.device',
);
public function testBootingPostData() {
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment