本文整理汇总了PHP中debug_mock::expect_write_error方法的典型用法代码示例。如果您正苦于以下问题:PHP debug_mock::expect_write_error方法的具体用法?PHP debug_mock::expect_write_error怎么用?PHP debug_mock::expect_write_error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类debug_mock
的用法示例。
在下文中一共展示了debug_mock::expect_write_error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_accessible_by_ids_no_ids
function test_accessible_by_ids_no_ids()
{
$this->_login_user(200, array(100 => 'admins', 110 => 'users'));
debug_mock::expect_write_error('ids array is empty');
$result = $this->object->fetch_accessible_by_ids(array());
$this->assertEqual($result, array());
}
示例2: _move_tree_across
function _move_tree_across($branches, $mvt, $nodecount)
{
foreach ($branches[0] as $nodeid => $node) {
foreach ($branches[1] as $tnodeid => $tnode) {
if ($nodeid == $tnodeid) {
debug_mock::expect_write_error(NESE_ERROR_RECURSION, array('id' => $nodeid, 'target_id' => $tnodeid));
} else {
$current_source = $this->_tree->get_node($nodeid);
$current_target = $this->_tree->get_node($tnodeid);
if ($current_target['root_id'] == $current_source['root_id'] && ($current_source['l'] <= $current_target['l'] && $current_source['r'] >= $current_target['r'])) {
debug_mock::expect_write_error(NESE_ERROR_RECURSION, array('id' => $nodeid, 'target_id' => $tnodeid));
}
}
if (($ret = $this->_tree->move_tree($nodeid, $tnodeid, $mvt)) === false) {
continue;
}
$mnode = $this->_tree->get_node($ret);
$this->assertEqual($ret, $nodeid, 'Nodeid was not returned as expected');
$this->assertEqual($nodecount, count($this->_tree->get_all_nodes()), 'Node count changed');
$p = $this->_tree->get_parent($nodeid);
if ($mvt == NESE_MOVE_BELOW) {
$this->assertEqual($tnode['id'], $p['id'], 'Move below failed (parent ID)');
}
if ($mnode['id'] != $mnode['root_id']) {
$this->assertEqual($p['id'], $mnode['parent_id'], 'Parent ID is wrong');
}
}
}
}
示例3: array
function test_create_no_such_action()
{
debug_mock :: expect_write_error('action not found', array('class_path' => 'no_such_action'));
$c =& action_factory :: create('no_such_action');
$this->assertIsA($c, 'empty_action');
}
示例4: test_create
function test_create()
{
$c =& action_factory::create('action');
$this->assertNotNull($c);
debug_mock::expect_write_error('action not found', array('class_path' => 'no_such_action'));
$c =& action_factory::create('no_such_action');
$this->assertNull($c);
}
示例5: test_save_object_access_wrong_action_no_parent_records
function test_save_object_access_wrong_action_no_parent_records()
{
$this->object->setReturnValue('get_id', -1);
$this->parent_object->setReturnValue('get_id', -2);
$this->parent_object->setReturnValue('get_class_id', 10);
$this->parent_object_controller->setReturnValue('determine_action', 'display');
debug_mock::expect_write_error('parent object has no acccess records at all', array('parent_id' => -2));
$this->assertFalse($this->ac->save_object_access($this->object, $this->parent_object));
}
示例6: test_failed_create
function test_failed_create()
{
debug_mock::expect_write_error('identifier is empty');
$this->assertIdentical($this->object->create(), false);
$this->object->set_parent_node_id(10);
debug_mock::expect_write_error('identifier is empty');
$this->assertIdentical($this->object->create(), false);
$this->object->set_identifier('test');
debug_mock::expect_write_error('tree registering failed', array('parent_node_id' => 10));
$this->assertIdentical($this->object->create(), false);
}
示例7: test_failed_create
function test_failed_create()
{
if (!$this->object->is_auto_identifier()) {
debug_mock::expect_write_error('identifier is empty');
$this->assertIdentical($this->object->create(), false);
}
$this->object->set_parent_node_id(1000000);
if (!$this->object->is_auto_identifier()) {
debug_mock::expect_write_error('identifier is empty');
$this->assertIdentical($this->object->create(), false);
}
$this->object->set_identifier('test');
if ($this->object->is_auto_identifier()) {
debug_mock::expect_write_error(NESE_ERROR_NOT_FOUND, array('id' => 1000000));
} else {
debug_mock::expect_write_error('tree registering failed', array('parent_node_id' => 1000000));
}
$this->assertIdentical($this->object->create(), false);
}
示例8: test_move_tree
function test_move_tree()
{
$movemodes[] = NESE_MOVE_BEFORE;
$movemodes[] = NESE_MOVE_AFTER;
$movemodes[] = NESE_MOVE_BELOW;
for ($j = 0; $j < count($movemodes); $j++) {
$mvt = $movemodes[$j];
// Build a nice random tree
$rnc = 1;
$depth = 2;
$npl = 2;
$relation_tree = $this->_create_sub_node($rnc, $depth, $npl);
$lastrid = false;
$rootnodes = $this->_tree->get_root_nodes();
$branches = array();
$allnodes1 = $this->_tree->get_all_nodes();
foreach ($rootnodes as $rid => $rootnode) {
if ($lastrid) {
if ($rid == $lastrid) {
debug_mock::expect_write_error(NESE_ERROR_RECURSION);
}
$this->_tree->move_tree($rid, $lastrid, $mvt);
}
$branch = $this->_tree->get_branch($rid);
if (!empty($branch)) {
$branches[] = $branch;
}
if (count($branches) == 2) {
$this->_move_tree_across($branches, $mvt, count($this->_tree->get_all_nodes()));
$branches = array();
}
$lastrid = $rid;
}
$allnodes2 = $this->_tree->get_all_nodes();
// Just make sure that all the nodes are still there
$this->assertFalse(count(array_diff(array_keys($allnodes1), array_keys($allnodes2))), 'Nodes got lost during the move');
}
return true;
}
示例9: test_update_file
function test_update_file()
{
$this->test_create_file();
$obj =& site_object_factory::create('file_object');
$this->db->sql_select('media');
$row = $this->db->fetch_row();
$obj->set_attribute('tmp_file_path', PROJECT_DIR . 'images/2.jpg');
$obj->set_attribute('file_name', 'new_name.jpg');
$obj->set_attribute('mime_type', 'image/jpeg');
debug_mock::expect_write_error('media id not set');
$this->assertFalse($obj->update_file(), __LINE__);
$obj->set_attribute('media_id', $row['id']);
$this->assertTrue($obj->update_file(), __LINE__);
$this->db->sql_select('media');
$arr = $this->db->get_array();
$media_id = $obj->get_attribute('media_id');
$this->assertTrue(is_array($arr), __LINE__);
$this->assertEqual(sizeof($arr), 1, __LINE__);
$this->assertEqual($arr[0]['id'], $media_id, __LINE__);
$this->assertEqual($arr[0]['file_name'], $obj->get_attribute('file_name'), __LINE__);
$this->assertEqual($arr[0]['mime_type'], $obj->get_attribute('mime_type'), __LINE__);
$this->assertTrue(file_exists(MEDIA_DIR . $media_id . '.media'), __LINE__);
$this->assertEqual(filesize(MEDIA_DIR . $media_id . '.media'), filesize($obj->get_attribute('tmp_file_path')), __LINE__);
}
示例10: instance
function test_get_wrong_type_value()
{
$sp =& sys_param :: instance();
debug_mock :: expect_write_error(
'trying to get undefined type in sys_param',
array (
'type' => 'blabla',
'param' => 'param_1',
)
);
$number = 123.053;
$sp->save_param('param_1', 'float', $number);
$this->assertNull($sp->get_param('param_1', 'blabla'));
$this->assertNull($sp->get_param('param_2'));
}
示例11: array
function test_failed_create()
{
if(!$this->object->is_auto_identifier())
{
debug_mock :: expect_write_error('identifier is empty');
$this->assertIdentical($this->object->create(), false, 'shouldn\'t be created, since identifier is not set');
}
$this->object->set_parent_node_id(1000000);
if(!$this->object->is_auto_identifier())
{
debug_mock :: expect_write_error('identifier is empty');
$this->assertIdentical($this->object->create(), false, 'shouldn\'t be created, since identifier is not set');
}
$this->object->set_identifier('test');
if($this->object->is_auto_identifier())
debug_mock :: expect_write_error(TREE_ERROR_NODE_NOT_FOUND, array('id' => 1000000));
else
debug_mock :: expect_write_error('tree registering failed', array('parent_node_id' => 1000000));
$this->assertIdentical($this->object->create(), false, 'shouldn\'t be created, since parent node is not valid');
}
示例12: array
function test_display_empty_view()
{
$this->request->setReturnValue('get_attribute', 'no_such_action', array('action'));
debug_mock :: expect_write_warning('action not found',
array (
'class' => 'site_object_controller_test_version1',
'action' => 'no_such_action',
'default_action' => 'display',
)
);
$this->assertIdentical($this->site_object_controller->determine_action($this->request), false);
debug_mock :: expect_write_error('template is null');
$this->site_object_controller->display_view();
}
示例13: test_perform_with_name
function test_perform_with_name()
{
$_REQUEST['test1']['username'] = 'vasa';
$_REQUEST['test1']['password'] = 'yo';
$_REQUEST['test1']['password_confirm'] = 'yo';
$a1 =& new form_action1('test1');
$this->assertIsA($a1->perform(), 'failed_response');
$_REQUEST['test1']['submitted'] = true;
debug_mock::expect_write_error('validation failed');
$this->assertIsA($a1->perform(), 'not_valid_response');
$_REQUEST['test1']['password'] = 'yoyoyoyo';
$_REQUEST['test1']['password_confirm'] = 'yoyoyoyo';
debug_mock::expect_write_error('validation failed');
$this->assertIsA($a1->perform(), 'not_valid_response', 'validation occurs only once');
$a2 =& new form_action1('test1');
$this->assertIsA($a2->perform(), 'response');
}
示例14: test_display_empty_view
function test_display_empty_view()
{
$_REQUEST['action'] = 'no_such_action';
debug_mock::expect_write_warning('action not found', array('class' => 'site_object_controller_test_version1', 'action' => 'no_such_action', 'default_action' => 'display'));
$this->assertIdentical($this->site_object_controller->determine_action(), false);
debug_mock::expect_write_error('template is null');
$this->site_object_controller->display_view();
}
示例15: array
function test_get_sub_branch_by_path_failed()
{
debug_mock :: expect_write_error(TREE_ERROR_NODE_NOT_FOUND, array('id' => 1));
$this->assertFalse($this->driver->get_sub_branch(1));
}