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


PHP User::getById方法代码示例

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


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

示例1: testSendWithoutEmailAddress

 public function testSendWithoutEmailAddress()
 {
     $en = new EmailNotification($this->container);
     $p = new Project($this->container);
     $tf = new TaskFinder($this->container);
     $tc = new TaskCreation($this->container);
     $u = new User($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'test')));
     $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
     $this->container['emailClient'] = $this->getMockBuilder('\\Core\\EmailClient')->setConstructorArgs(array($this->container))->setMethods(array('send'))->getMock();
     $this->container['emailClient']->expects($this->never())->method('send');
     $en->send($u->getById(1), Task::EVENT_CREATE, array('task' => $tf->getDetails(1)));
 }
开发者ID:hj3938,项目名称:kanboard,代码行数:13,代码来源:EmailNotificationTest.php

示例2: testUpdate

 public function testUpdate()
 {
     $u = new User($this->registry);
     $this->assertTrue($u->create(array('username' => 'toto', 'password' => '123456', 'name' => 'Toto')));
     $this->assertTrue($u->update(array('id' => 2, 'username' => 'biloute')));
     $user = $u->getById(2);
     $this->assertNotFalse($user);
     $this->assertTrue(is_array($user));
     $this->assertEquals('biloute', $user['username']);
     $this->assertEquals('Toto', $user['name']);
     $this->assertEquals(0, $user['is_admin']);
     $this->assertEquals(0, $user['is_ldap_user']);
 }
开发者ID:cvalenti,项目名称:kanboard,代码行数:13,代码来源:UserTest.php

示例3: testGetAll

 public function testGetAll()
 {
     $wn = new WebNotification($this->container);
     $p = new Project($this->container);
     $tf = new TaskFinder($this->container);
     $tc = new TaskCreation($this->container);
     $u = new User($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'test')));
     $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
     $wn->send($u->getById(1), Task::EVENT_CREATE, array('task' => $tf->getDetails(1)));
     $wn->send($u->getById(1), Task::EVENT_CREATE, array('task' => $tf->getDetails(1)));
     $this->assertEmpty($wn->getAll(2));
     $notifications = $wn->getAll(1);
     $this->assertCount(2, $notifications);
     $this->assertArrayHasKey('title', $notifications[0]);
     $this->assertTrue(is_array($notifications[0]['event_data']));
 }
开发者ID:hj3938,项目名称:kanboard,代码行数:17,代码来源:WebNotificationTest.php

示例4: testEnableDisablePublicAccess

 public function testEnableDisablePublicAccess()
 {
     $u = new User($this->container);
     $this->assertNotFalse($u->create(array('username' => 'toto', 'password' => '123456')));
     $user = $u->getById(2);
     $this->assertNotEmpty($user);
     $this->assertEquals('toto', $user['username']);
     $this->assertEmpty($user['token']);
     $this->assertTrue($u->enablePublicAccess(2));
     $user = $u->getById(2);
     $this->assertNotEmpty($user);
     $this->assertEquals('toto', $user['username']);
     $this->assertNotEmpty($user['token']);
     $this->assertTrue($u->disablePublicAccess(2));
     $user = $u->getById(2);
     $this->assertNotEmpty($user);
     $this->assertEquals('toto', $user['username']);
     $this->assertEmpty($user['token']);
 }
开发者ID:NextGenIntelligence,项目名称:kanboard,代码行数:19,代码来源:UserTest.php

示例5: function

});
$server->register('removeTask', function ($task_id) use($task) {
    return $task->remove($task_id);
});
$server->register('moveTaskPosition', function ($project_id, $task_id, $column_id, $position) use($task) {
    return $task->movePosition($project_id, $task_id, $column_id, $position);
});
/**
 * User procedures
 */
$server->register('createUser', function (array $values) use($user) {
    list($valid, ) = $user->validateCreation($values);
    return $valid && $user->create($values);
});
$server->register('getUser', function ($user_id) use($user) {
    return $user->getById($user_id);
});
$server->register('getAllUsers', function () use($user) {
    return $user->getAll();
});
$server->register('updateUser', function ($values) use($user) {
    list($valid, ) = $user->validateModification($values);
    return $valid && $user->update($values);
});
$server->register('removeUser', function ($user_id) use($user) {
    return $user->remove($user_id);
});
/**
 * Category procedures
 */
$server->register('createCategory', function ($project_id, $name) use($category) {
开发者ID:Null-Kelvin,项目名称:kanboard,代码行数:31,代码来源:jsonrpc.php

示例6: testFilterUserWithBothFilterAndProjectSelected

 public function testFilterUserWithBothFilterAndProjectSelected()
 {
     $u = new User($this->container);
     $n = new Notification($this->container);
     $nf = new NotificationFilter($this->container);
     $p = new Project($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'UnitTest1')));
     $this->assertEquals(2, $p->create(array('name' => 'UnitTest2')));
     $this->assertEquals(2, $u->create(array('username' => 'user2', 'notifications_filter' => NotificationFilter::FILTER_BOTH)));
     $n->saveSettings(2, array('notifications_enabled' => 1, 'notification_projects' => array(2 => true)));
     $this->assertFalse($nf->shouldReceiveNotification($u->getById(2), array('task' => array('project_id' => 1, 'creator_id' => 2, 'owner_id' => 3))));
     $this->assertFalse($nf->shouldReceiveNotification($u->getById(2), array('task' => array('project_id' => 1, 'creator_id' => 0, 'owner_id' => 2))));
     $this->assertTrue($nf->shouldReceiveNotification($u->getById(2), array('task' => array('project_id' => 2, 'creator_id' => 2, 'owner_id' => 3))));
     $this->assertTrue($nf->shouldReceiveNotification($u->getById(2), array('task' => array('project_id' => 2, 'creator_id' => 0, 'owner_id' => 2))));
 }
开发者ID:hj3938,项目名称:kanboard,代码行数:15,代码来源:NotificationFilterTest.php


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