Differential D20321 Diff 48510 src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php
Show First 20 Lines • Show All 1,002 Lines • ▼ Show 20 Lines | public function testBoardMoves() { | ||||
$this->assertColumns($expect, $user, $board, $task2); | $this->assertColumns($expect, $user, $board, $task2); | ||||
// Now the stuff should be in the column, in order, with the more recently | // Now the stuff should be in the column, in order, with the more recently | ||||
// moved task on top. | // moved task on top. | ||||
$expect = array( | $expect = array( | ||||
$task2->getPHID(), | $task2->getPHID(), | ||||
$task1->getPHID(), | $task1->getPHID(), | ||||
); | ); | ||||
$this->assertTasksInColumn($expect, $user, $board, $column); | $label = pht('Simple move'); | ||||
$this->assertTasksInColumn($expect, $user, $board, $column, $label); | |||||
// Move the second task after the first task. | // Move the second task after the first task. | ||||
$options = array( | $options = array( | ||||
'afterPHID' => $task1->getPHID(), | 'afterPHIDs' => array($task1->getPHID()), | ||||
); | ); | ||||
$this->moveToColumn($user, $board, $task2, $column, $column, $options); | $this->moveToColumn($user, $board, $task2, $column, $column, $options); | ||||
$expect = array( | $expect = array( | ||||
$task1->getPHID(), | $task1->getPHID(), | ||||
$task2->getPHID(), | $task2->getPHID(), | ||||
); | ); | ||||
$this->assertTasksInColumn($expect, $user, $board, $column); | $label = pht('With afterPHIDs'); | ||||
$this->assertTasksInColumn($expect, $user, $board, $column, $label); | |||||
// Move the second task before the first task. | // Move the second task before the first task. | ||||
$options = array( | $options = array( | ||||
'beforePHID' => $task1->getPHID(), | 'beforePHIDs' => array($task1->getPHID()), | ||||
); | ); | ||||
$this->moveToColumn($user, $board, $task2, $column, $column, $options); | $this->moveToColumn($user, $board, $task2, $column, $column, $options); | ||||
$expect = array( | $expect = array( | ||||
$task2->getPHID(), | $task2->getPHID(), | ||||
$task1->getPHID(), | $task1->getPHID(), | ||||
); | ); | ||||
$this->assertTasksInColumn($expect, $user, $board, $column); | $label = pht('With beforePHIDs'); | ||||
$this->assertTasksInColumn($expect, $user, $board, $column, $label); | |||||
} | } | ||||
public function testMilestoneMoves() { | public function testMilestoneMoves() { | ||||
$user = $this->createUser(); | $user = $this->createUser(); | ||||
$user->save(); | $user->save(); | ||||
$board = $this->createProject($user); | $board = $this->createProject($user); | ||||
▲ Show 20 Lines • Show All 286 Lines • ▼ Show 20 Lines | private function loadColumns( | ||||
return $column_phids; | return $column_phids; | ||||
} | } | ||||
private function assertTasksInColumn( | private function assertTasksInColumn( | ||||
array $expect, | array $expect, | ||||
PhabricatorUser $viewer, | PhabricatorUser $viewer, | ||||
PhabricatorProject $board, | PhabricatorProject $board, | ||||
PhabricatorProjectColumn $column) { | PhabricatorProjectColumn $column, | ||||
$label = null) { | |||||
$engine = id(new PhabricatorBoardLayoutEngine()) | $engine = id(new PhabricatorBoardLayoutEngine()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->setBoardPHIDs(array($board->getPHID())) | ->setBoardPHIDs(array($board->getPHID())) | ||||
->setObjectPHIDs($expect) | ->setObjectPHIDs($expect) | ||||
->executeLayout(); | ->executeLayout(); | ||||
$object_phids = $engine->getColumnObjectPHIDs( | $object_phids = $engine->getColumnObjectPHIDs( | ||||
$board->getPHID(), | $board->getPHID(), | ||||
$column->getPHID()); | $column->getPHID()); | ||||
$object_phids = array_values($object_phids); | $object_phids = array_values($object_phids); | ||||
$this->assertEqual($expect, $object_phids); | $this->assertEqual($expect, $object_phids, $label); | ||||
} | } | ||||
private function addColumn( | private function addColumn( | ||||
PhabricatorUser $viewer, | PhabricatorUser $viewer, | ||||
PhabricatorProject $project, | PhabricatorProject $project, | ||||
$sequence) { | $sequence) { | ||||
$project->setHasWorkboard(1)->save(); | $project->setHasWorkboard(1)->save(); | ||||
▲ Show 20 Lines • Show All 334 Lines • Show Last 20 Lines |