Skip to content

Instantly share code, notes, and snippets.

@styks1987
Last active August 29, 2015 14:22
Show Gist options
  • Save styks1987/15e12e5eca789f20c7de to your computer and use it in GitHub Desktop.
Save styks1987/15e12e5eca789f20c7de to your computer and use it in GitHub Desktop.
public function __construct($id = false, $table = null, $ds = null) {
parent::__construct($id, $table, $ds);
$activities = new ActivityListener();
$this->getEventManager()->attach($activities);
}
public function setUp() {
parent::setUp();
$this->AppModel = ClassRegistry::init('AppModel');
$this->AppModel->useTable = false;
$this->AppModel = $this->getMockForModel('AppModel');
// This is where the error happens
$this->AppModel->UserComment = $this->getMockForModel('UserComment');
}
public function testGetTaskId(){
$test_id = 'Pwf_task_7465';
$id = $this->AppModel->get_task_id($test_id);
$this->assertEqual($id, $test_id);
$missing_id = 'Pwf_task_0000';
$id = $this->AppModel->get_task_id($missing_id);
$this->assertEqual($id, null);
$test_id = 'Pwf_project_7777';
$id = $this->AppModel->get_project_id($test_id);
$this->assertEqual($id, $test_id);
$missing_id = 'Pwf_project_0000';
$id = $this->AppModel->get_project_id($missing_id);
$this->assertEqual($id, null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment