当前位置: 首页>>代码示例>>PHP>>正文


PHP WooThemes_Sensei_Utils::update_user_data方法代码示例

本文整理汇总了PHP中WooThemes_Sensei_Utils::update_user_data方法的典型用法代码示例。如果您正苦于以下问题:PHP WooThemes_Sensei_Utils::update_user_data方法的具体用法?PHP WooThemes_Sensei_Utils::update_user_data怎么用?PHP WooThemes_Sensei_Utils::update_user_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WooThemes_Sensei_Utils的用法示例。


在下文中一共展示了WooThemes_Sensei_Utils::update_user_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testDeleteUserData

 /**
  * This tests Woothemes_Sensei_Utils::delete_user_data
  */
 public function testDeleteUserData()
 {
     // does this function add_user_data exist?
     $this->assertTrue(method_exists('WooThemes_Sensei_Utils', 'delete_user_data'), 'The utils class function `delete_user_data` does not exist ');
     // does it return false for invalid the parameters?
     $invalid_data_message = 'This function does not check false data correctly';
     $this->assertFalse(WooThemes_Sensei_Utils::delete_user_data('', '', ''), $invalid_data_message . ": '','','' ");
     $this->assertFalse(WooThemes_Sensei_Utils::delete_user_data(' ', ' ', ' '), $invalid_data_message . ": ' ', ' ', ' ' ");
     $this->assertFalse(WooThemes_Sensei_Utils::delete_user_data(-1, -2, -3), $invalid_data_message . ": -1,-2, -3 ");
     $this->assertFalse(WooThemes_Sensei_Utils::delete_user_data('key', 500, 5000), $invalid_data_message . ": 500, 'key', 5000");
     // setup the data for the next assertions
     $test_user_id = wp_create_user('testDeleteUserData', 'testDeleteUserData', 'testDeleteUserData@test.com');
     $test_array = array(1, 2, 3, 4);
     $test_lesson_id = $this->factory->post->create(array('post_type' => "lesson"));
     $test_data_key = 'test_key';
     //does this function return false when there is no lesson status?
     $this->assertFalse(WooThemes_Sensei_Utils::get_user_data($test_data_key, $test_lesson_id, $test_user_id), 'This function should return false when the status has not be set for the given post type');
     //setup assertion data
     WooThemes_Sensei_Utils::update_user_data($test_data_key, $test_lesson_id, $test_array, $test_user_id);
     $deleted = WooThemes_Sensei_Utils::delete_user_data($test_data_key, $test_lesson_id, $test_user_id);
     $retrieved_value = WooThemes_Sensei_Utils::get_user_data($test_data_key, $test_lesson_id, $test_user_id);
     // doest the function successfully delete existing Sensei user data ?
     $this->assertTrue($deleted, 'The user data should have been deleted, but was not');
     $this->assertEmpty($retrieved_value, 'After deleting the user data should return false');
 }
开发者ID:pra85,项目名称:sensei,代码行数:28,代码来源:test-class-utils.php


注:本文中的WooThemes_Sensei_Utils::update_user_data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。