本文整理汇总了PHP中Kanboard\Model\Project::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::update方法的具体用法?PHP Project::update怎么用?PHP Project::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kanboard\Model\Project
的用法示例。
在下文中一共展示了Project::update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAllowEverybody
public function testAllowEverybody()
{
$user = new User($this->container);
$this->assertNotFalse($user->create(array('username' => 'unittest#1', 'password' => 'unittest')));
$this->assertNotFalse($user->create(array('username' => 'unittest#2', 'password' => 'unittest')));
$p = new Project($this->container);
$pp = new ProjectPermission($this->container);
$this->assertEquals(1, $p->create(array('name' => 'UnitTest')));
$this->assertFalse($pp->isEverybodyAllowed(1));
$this->assertTrue($pp->isUserAllowed(1, 1));
$this->assertFalse($pp->isUserAllowed(1, 2));
$this->assertFalse($pp->isUserAllowed(1, 3));
$this->assertEquals(array(), $pp->getMembers(1));
$this->assertEquals(array('Unassigned'), $pp->getMemberList(1));
$this->assertEmpty($pp->getMemberProjects(1));
$this->assertEmpty($pp->getMemberProjects(2));
$this->assertEmpty($pp->getMemberProjects(3));
$this->assertEmpty($pp->getMemberProjectIds(1));
$this->assertEmpty($pp->getMemberProjectIds(2));
$this->assertEmpty($pp->getMemberProjectIds(3));
$this->assertEmpty($pp->getActiveMemberProjectIds(1));
$this->assertEmpty($pp->getActiveMemberProjectIds(2));
$this->assertEmpty($pp->getActiveMemberProjectIds(3));
$this->assertEmpty($pp->getActiveMemberProjects(1));
$this->assertEmpty($pp->getActiveMemberProjects(2));
$this->assertEmpty($pp->getActiveMemberProjects(3));
$this->assertTrue($p->update(array('id' => 1, 'is_everybody_allowed' => 1)));
$this->assertTrue($pp->isEverybodyAllowed(1));
$this->assertTrue($pp->isUserAllowed(1, 1));
$this->assertTrue($pp->isUserAllowed(1, 2));
$this->assertTrue($pp->isUserAllowed(1, 3));
$this->assertEquals(array('1' => 'admin', '2' => 'unittest#1', '3' => 'unittest#2'), $pp->getMembers(1));
$this->assertEquals(array('Unassigned', '1' => 'admin', '2' => 'unittest#1', '3' => 'unittest#2'), $pp->getMemberList(1));
$this->assertNotEmpty($pp->getMemberProjects(1));
$this->assertNotEmpty($pp->getMemberProjects(2));
$this->assertNotEmpty($pp->getMemberProjects(3));
$this->assertNotEmpty($pp->getMemberProjectIds(1));
$this->assertNotEmpty($pp->getMemberProjectIds(2));
$this->assertNotEmpty($pp->getMemberProjectIds(3));
$this->assertNotEmpty($pp->getActiveMemberProjectIds(1));
$this->assertNotEmpty($pp->getActiveMemberProjectIds(2));
$this->assertNotEmpty($pp->getActiveMemberProjectIds(3));
$this->assertNotEmpty($pp->getActiveMemberProjects(1));
$this->assertNotEmpty($pp->getActiveMemberProjects(2));
$this->assertNotEmpty($pp->getActiveMemberProjects(3));
$this->assertTrue($p->disable(1));
$this->assertEmpty($pp->getActiveMemberProjectIds(1));
$this->assertEmpty($pp->getActiveMemberProjectIds(2));
$this->assertEmpty($pp->getActiveMemberProjectIds(3));
$this->assertEmpty($pp->getActiveMemberProjects(1));
$this->assertEmpty($pp->getActiveMemberProjects(2));
$this->assertEmpty($pp->getActiveMemberProjects(3));
}
示例2: testPriority
public function testPriority()
{
$projectModel = new Project($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'My project 2')));
$project = $projectModel->getById(1);
$this->assertNotEmpty($project);
$this->assertEquals(0, $project['priority_default']);
$this->assertEquals(0, $project['priority_start']);
$this->assertEquals(3, $project['priority_end']);
$this->assertTrue($projectModel->update(array('id' => 1, 'priority_start' => 2, 'priority_end' => 5, 'priority_default' => 4)));
$project = $projectModel->getById(1);
$this->assertNotEmpty($project);
$this->assertEquals(4, $project['priority_default']);
$this->assertEquals(2, $project['priority_start']);
$this->assertEquals(5, $project['priority_end']);
}
示例3: testIdentifier
public function testIdentifier()
{
$p = new Project($this->container);
// Creation
$this->assertEquals(1, $p->create(array('name' => 'UnitTest1', 'identifier' => 'test1')));
$this->assertEquals(2, $p->create(array('name' => 'UnitTest2')));
$project = $p->getById(1);
$this->assertNotEmpty($project);
$this->assertEquals('TEST1', $project['identifier']);
$project = $p->getById(2);
$this->assertNotEmpty($project);
$this->assertEquals('', $project['identifier']);
// Update
$this->assertTrue($p->update(array('id' => '2', 'identifier' => 'test2')));
$project = $p->getById(2);
$this->assertNotEmpty($project);
$this->assertEquals('TEST2', $project['identifier']);
$project = $p->getByIdentifier('test1');
$this->assertNotEmpty($project);
$this->assertEquals('TEST1', $project['identifier']);
$project = $p->getByIdentifier('');
$this->assertFalse($project);
}
示例4: testIdentifier
public function testIdentifier()
{
$p = new Project($this->container);
// Creation
$this->assertEquals(1, $p->create(array('name' => 'UnitTest1', 'identifier' => 'test1')));
$this->assertEquals(2, $p->create(array('name' => 'UnitTest2')));
$project = $p->getById(1);
$this->assertNotEmpty($project);
$this->assertEquals('TEST1', $project['identifier']);
$project = $p->getById(2);
$this->assertNotEmpty($project);
$this->assertEquals('', $project['identifier']);
// Update
$this->assertTrue($p->update(array('id' => '2', 'identifier' => 'test2')));
$project = $p->getById(2);
$this->assertNotEmpty($project);
$this->assertEquals('TEST2', $project['identifier']);
$project = $p->getByIdentifier('test1');
$this->assertNotEmpty($project);
$this->assertEquals('TEST1', $project['identifier']);
$project = $p->getByIdentifier('');
$this->assertFalse($project);
// Validation rules
$r = $p->validateCreation(array('name' => 'test', 'identifier' => 'TEST1'));
$this->assertFalse($r[0]);
$r = $p->validateCreation(array('name' => 'test', 'identifier' => 'test1'));
$this->assertFalse($r[0]);
$r = $p->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => 'TEST1'));
$this->assertTrue($r[0]);
$r = $p->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => 'test3'));
$this->assertTrue($r[0]);
$r = $p->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => ''));
$this->assertTrue($r[0]);
$r = $p->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => 'TEST2'));
$this->assertFalse($r[0]);
$r = $p->validateCreation(array('name' => 'test', 'identifier' => 'a-b-c'));
$this->assertFalse($r[0]);
$r = $p->validateCreation(array('name' => 'test', 'identifier' => 'test 123'));
$this->assertFalse($r[0]);
}
示例5: testCloneInactiveProject
public function testCloneInactiveProject()
{
$p = new Project($this->container);
$pd = new ProjectDuplication($this->container);
$this->assertEquals(1, $p->create(array('name' => 'Inactive')));
$this->assertTrue($p->update(array('id' => 1, 'is_active' => 0)));
$project = $p->getById(1);
$this->assertEquals(0, $project['is_active']);
$this->assertEquals(2, $pd->duplicate(1));
$project = $p->getById(2);
$this->assertNotEmpty($project);
$this->assertEquals('Inactive (Clone)', $project['name']);
$this->assertEquals(1, $project['is_active']);
}