summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Johnson <christopher.johnson@wikimedia.de>2015-04-09 10:29:07 (GMT)
committerChristopher Johnson <christopher.johnson@wikimedia.de>2015-04-09 10:29:07 (GMT)
commit9b736dcebdeb09df2d2e16ae748f9b6dfd52ad9a (patch)
tree5b6ee341824cb6d6de4a7139778bc02d6ffbcf4e
parent4e94f3439f2048a891c5d89439c9231aed5914a0 (diff)
downloadphabricator-sprint-9b736dcebdeb09df2d2e16ae748f9b6dfd52ad9a.tar.gz
phabricator-sprint-9b736dcebdeb09df2d2e16ae748f9b6dfd52ad9a.tar.xz
minor lint changes
Change-Id: I659b4399ab38e1250dba6faed9535f2e6b502eab
-rw-r--r--src/customfield/SprintEndDateField.php3
-rw-r--r--src/customfield/SprintProjectCustomField.php4
-rw-r--r--src/storage/SprintStats.php10
-rw-r--r--src/tests/Autoloader.php7
-rw-r--r--src/tests/DateIterator.php13
-rw-r--r--src/tests/SprintCustomFieldTest.php33
-rw-r--r--src/tests/SprintQueryTest.php12
-rw-r--r--src/tests/SprintStatsTest.php53
-rw-r--r--src/tests/bootstrap.php14
-rw-r--r--src/tests/phpunit.xml3
-rw-r--r--src/view/burndown/BoardDataPieView.php2
11 files changed, 76 insertions, 78 deletions
diff --git a/src/customfield/SprintEndDateField.php b/src/customfield/SprintEndDateField.php
index a247d28..dd17dbf 100644
--- a/src/customfield/SprintEndDateField.php
+++ b/src/customfield/SprintEndDateField.php
@@ -37,8 +37,7 @@ final class SprintEndDateField extends SprintProjectCustomField {
}
// == Search
- public function shouldAppearInApplicationSearch()
- {
+ public function shouldAppearInApplicationSearch() {
return true;
}
}
diff --git a/src/customfield/SprintProjectCustomField.php b/src/customfield/SprintProjectCustomField.php
index 7f921ce..d230c52 100644
--- a/src/customfield/SprintProjectCustomField.php
+++ b/src/customfield/SprintProjectCustomField.php
@@ -10,7 +10,7 @@ abstract class SprintProjectCustomField extends PhabricatorProjectCustomField
protected function isSprint() {
- $validator = new SprintValidator;
+ $validator = new SprintValidator();
$issprint = call_user_func(array($validator, 'checkForSprint'),
array($validator, 'isSprint'), $this->getObject()->getPHID());
return $issprint;
@@ -34,7 +34,7 @@ abstract class SprintProjectCustomField extends PhabricatorProjectCustomField
->setApplicationField($obj)
->setFieldConfig(array(
'name' => $name,
- 'description' => $description
+ 'description' => $description,
));
$this->setProxy($dateproxy);
return $dateproxy;
diff --git a/src/storage/SprintStats.php b/src/storage/SprintStats.php
index 1fe8daa..935c0ec 100644
--- a/src/storage/SprintStats.php
+++ b/src/storage/SprintStats.php
@@ -23,9 +23,9 @@ final class SprintStats {
public function buildDateArray($start, $end, DateTimeZone $timezone) {
$dates = array();
$period = new DatePeriod(
- id(new DateTime("@" . $start, $timezone))->setTime(2, 0),
+ id(new DateTime('@'.$start, $timezone))->setTime(2, 0),
new DateInterval('P1D'), // 1 day interval
- id(new DateTime("@" . $end, $timezone))->modify('+1 day')->setTime(17, 0));
+ id(new DateTime('@'.$end, $timezone))->modify('+1 day')->setTime(17, 0));
foreach ($period as $day) {
$dates[$day->format('D M j')] = $this->getBurndownDate(
@@ -36,7 +36,7 @@ final class SprintStats {
}
public function buildBefore($start, $timezone) {
- $before = id(new DateTime("@" . $start, $timezone))->modify('-1 day')->setTime(2, 0);
+ $before = id(new DateTime('@'.$start, $timezone))->modify('-1 day')->setTime(2, 0);
return $this->getBurndownDate($before->format('D M j'));
}
@@ -111,7 +111,7 @@ final class SprintStats {
public function calcTasksRemaining($dates) {
$first = true;
- $previous = new BurndownDataDate($date=null);
+ $previous = new BurndownDataDate($date = null);
$sprintpoints = id(new SprintPoints())
->setTaskPoints($this->taskpoints);
$tasks_total = $sprintpoints->sumTotalTasks();
@@ -163,7 +163,7 @@ final class SprintStats {
pht('Remaining Points'),
pht('Ideal Points'),
pht('Points Closed Today'),
- ));
+ ),);
foreach ($dates as $key => $date) {
$data[] = array(
diff --git a/src/tests/Autoloader.php b/src/tests/Autoloader.php
index 78f1f86..87a3d2d 100644
--- a/src/tests/Autoloader.php
+++ b/src/tests/Autoloader.php
@@ -15,7 +15,7 @@ class AutoLoader {
if ($file->isDir() && !$file->isLink() && !$file->isDot()) {
// recurse into directories other than a few special ones
self::registerDirectory($file->getPathname());
- } elseif (substr($file->getFilename(), -4) === '.php') {
+ } else if (substr($file->getFilename(), -4) === '.php') {
// save the class name / path of a .php file found
$className = substr($file->getFilename(), 0, -4);
AutoLoader::registerClass($className, $file->getPathname());
@@ -33,10 +33,11 @@ class AutoLoader {
public static function loadClass($className) {
if (isset(AutoLoader::$classNames[$className])) {
- require_once(AutoLoader::$classNames[$className]);
+ require_once AutoLoader::$classNames[$className];
}
}
}
-spl_autoload_register(array('AutoLoader', 'loadClass')); \ No newline at end of file
+spl_autoload_register(array('AutoLoader', 'loadClass'));
+
diff --git a/src/tests/DateIterator.php b/src/tests/DateIterator.php
index c52bdd9..c7342fc 100644
--- a/src/tests/DateIterator.php
+++ b/src/tests/DateIterator.php
@@ -9,29 +9,30 @@ class DateIterator implements Iterator {
$this->array = $dates;
}
- function rewind() {
+ public function rewind() {
var_dump(__METHOD__);
$this->position = 0;
}
- function current() {
+ public function current() {
var_dump(__METHOD__);
return $this->array[$this->position];
}
- function key() {
+ public function key() {
var_dump(__METHOD__);
return $this->position;
}
- function next() {
+ public function next() {
var_dump(__METHOD__);
++$this->position;
}
- function valid() {
+ public function valid() {
var_dump(__METHOD__);
return isset($this->array[$this->position]);
}
-} \ No newline at end of file
+}
+
diff --git a/src/tests/SprintCustomFieldTest.php b/src/tests/SprintCustomFieldTest.php
index 61a9f96..2364f93 100644
--- a/src/tests/SprintCustomFieldTest.php
+++ b/src/tests/SprintCustomFieldTest.php
@@ -1,55 +1,55 @@
<?php
final class SprintCustomFieldTest extends SprintTestCase {
- public function testgetBeginFieldName() {
+ public function testgetBeginFieldName() {
$subclassname = new SprintBeginDateField();
$fieldname = $subclassname->getFieldName();
$this->assertEquals($fieldname, 'Sprint Start Date');
}
- public function testgetBeginFieldKey() {
+ public function testgetBeginFieldKey() {
$subclassname = new SprintBeginDateField();
$fieldname = $subclassname->getFieldKey();
$this->assertEquals($fieldname, 'isdc:sprint:startdate');
}
- public function testgetBeginFieldDescription() {
+ public function testgetBeginFieldDescription() {
$subclassname = new SprintBeginDateField();
$fieldname = $subclassname->getFieldDescription();
$this->assertEquals($fieldname, 'When a sprint starts');
}
- public function testgetStoryPointsFieldName() {
+ public function testgetStoryPointsFieldName() {
$subclassname = new SprintTaskStoryPointsField();
$fieldname = $subclassname->getFieldName();
$this->assertEquals($fieldname, 'Story Points');
}
- public function testgetStoryPointsFieldKey() {
+ public function testgetStoryPointsFieldKey() {
$subclassname = new SprintTaskStoryPointsField();
$fieldname = $subclassname->getFieldKey();
$this->assertEquals($fieldname, 'isdc:sprint:storypoints');
}
- public function testgetStoryPointsFieldDescription() {
+ public function testgetStoryPointsFieldDescription() {
$subclassname = new SprintTaskStoryPointsField();
$fieldname = $subclassname->getFieldDescription();
$this->assertEquals($fieldname, 'Estimated story points for this task');
}
- public function testgetEndFieldName() {
+ public function testgetEndFieldName() {
$subclassname = new SprintEndDateField();
$fieldname = $subclassname->getFieldName();
$this->assertEquals($fieldname, 'Sprint End Date');
}
- public function testgetEndFieldKey() {
+ public function testgetEndFieldKey() {
$subclassname = new SprintEndDateField();
$fieldname = $subclassname->getFieldKey();
$this->assertEquals($fieldname, 'isdc:sprint:enddate');
}
- public function testgetEndFieldDescription() {
+ public function testgetEndFieldDescription() {
$subclassname = new SprintEndDateField();
$fieldname = $subclassname->getFieldDescription();
$this->assertEquals($fieldname, 'When a sprint ends');
@@ -90,8 +90,7 @@ final class SprintCustomFieldTest extends SprintTestCase {
$mock->getFieldKey();
}
- public function testnewDateControl()
- {
+ public function testnewDateControl() {
$classname = 'SprintProjectCustomField';
$datecontrol = new AphrontFormDateControl();
$proxy = new PhabricatorStandardCustomFieldDate();
@@ -110,8 +109,7 @@ final class SprintCustomFieldTest extends SprintTestCase {
$this->assertEquals('AphrontFormDateControl', get_class($control));
}
- public function testrenderDateProxyPropertyViewValue()
- {
+ public function testrenderDateProxyPropertyViewValue() {
$classname = 'SprintProjectCustomField';
$datefield = new PhabricatorStandardCustomFieldDate();
@@ -129,8 +127,7 @@ final class SprintCustomFieldTest extends SprintTestCase {
$this->assertEquals('PhabricatorStandardCustomFieldDate', get_class($proxy));
}
- public function testrenderDateProxyEditControl()
- {
+ public function testrenderDateProxyEditControl() {
$classname = 'SprintProjectCustomField';
$datefield = new PhabricatorStandardCustomFieldDate();
@@ -148,8 +145,7 @@ final class SprintCustomFieldTest extends SprintTestCase {
$this->assertEquals('PhabricatorStandardCustomFieldDate', get_class($proxy));
}
- public function testrenderPropertyViewValue()
- {
+ public function testrenderPropertyViewValue() {
$classname = 'SprintProjectCustomField';
$proxy = new PhabricatorStandardCustomFieldDate();
$handles = array();
@@ -167,8 +163,7 @@ final class SprintCustomFieldTest extends SprintTestCase {
$this->assertSame($proxy, $mock->renderPropertyViewValue($handles));
}
- public function testgetStandardCustomFieldNamespace()
- {
+ public function testgetStandardCustomFieldNamespace() {
$classname = 'SprintProjectCustomField';
$mock = $this->getMockBuilder($classname)
diff --git a/src/tests/SprintQueryTest.php b/src/tests/SprintQueryTest.php
index 10792fa..ec0d678 100644
--- a/src/tests/SprintQueryTest.php
+++ b/src/tests/SprintQueryTest.php
@@ -1,14 +1,12 @@
<?php
final class SprintQueryTest extends SprintTestCase {
- public function getRequestObject()
- {
+ public function getRequestObject() {
$r = new AphrontRequest('example.com', '/');
return $r;
}
- public function testRequestSetUser()
- {
+ public function testRequestSetUser() {
$r = new AphrontRequest('example.com', '/');
$user = $this->generateNewTestUser();
$r->setUser($user);
@@ -17,8 +15,7 @@ final class SprintQueryTest extends SprintTestCase {
}
- public function PHIDProvider()
- {
+ public function PHIDProvider() {
return array(
'PHID-PROJ-mp777tqnkvivubj26ufu',
);
@@ -55,4 +52,5 @@ final class SprintQueryTest extends SprintTestCase {
// $this->assertInstanceof('PhabricatorObjectHandle', $handle);
// }
-} \ No newline at end of file
+}
+
diff --git a/src/tests/SprintStatsTest.php b/src/tests/SprintStatsTest.php
index 4455d32..6195797 100644
--- a/src/tests/SprintStatsTest.php
+++ b/src/tests/SprintStatsTest.php
@@ -3,13 +3,13 @@ final class SprintStatsTest extends SprintTestCase {
private $short_interval = 28800; // 8 hours
- private $day_interval = 86400; //1 days
- private $week_interval = 604800; //1 week
- private $multi_month_interval = 7257600; //3 months
+ private $day_interval = 86400; // 1 days
+ private $week_interval = 604800; // 1 week
+ private $multi_month_interval = 7257600; // 3 months
private $year_interval = 29030400; // 1 year
public function testSetTimezone() {
- $stats = new SprintStats;
+ $stats = new SprintStats();
$viewer = $this->generateNewTestUser();
$timezone = $stats->setTimezone($viewer);
$expected_timezone = new DateTimeZone($viewer->getTimezoneIdentifier());
@@ -33,7 +33,7 @@ final class SprintStatsTest extends SprintTestCase {
/**
* @param string $now
*/
- function short_date($now) {
+ public function short_date($now) {
$short = array($now + $this->short_interval,$now + $this->short_interval*2,$now + $this->short_interval*3, $now + $this->short_interval*4, $now + $this->short_interval*5);
return $short;
}
@@ -41,7 +41,7 @@ final class SprintStatsTest extends SprintTestCase {
/**
* @param string $now
*/
- function medium_date($now) {
+ public function medium_date($now) {
$medium = array($now + $this->day_interval,$now + $this->day_interval*2, $now + $this->day_interval*3,$now + $this->day_interval*4, $now + $this->day_interval*5);
return $medium;
}
@@ -49,7 +49,7 @@ final class SprintStatsTest extends SprintTestCase {
/**
* @param string $now
*/
- function long_date($now) {
+ public function long_date($now) {
$long = array($now + $this->week_interval,$now + $this->week_interval*2, $now + $this->week_interval*4,$this->multi_month_interval, $this->year_interval);
return $long;
}
@@ -59,7 +59,7 @@ final class SprintStatsTest extends SprintTestCase {
* @dataProvider providerDateArray
*/
public function testbuildTimeSeries($end) {
- $stats = new SprintStats;
+ $stats = new SprintStats();
$viewer = $this->generateNewTestUser();
$timezone = $stats->setTimezone($viewer);
$date = new DateTime();
@@ -69,7 +69,7 @@ final class SprintStatsTest extends SprintTestCase {
}
public function testbuildBefore() {
- $stats = new SprintStats;
+ $stats = new SprintStats();
$viewer = $this->generateNewTestUser();
$timezone = $stats->setTimezone($viewer);
$date = new DateTime();
@@ -79,94 +79,95 @@ final class SprintStatsTest extends SprintTestCase {
}
public function testgetBurndownDate() {
- $stats = new SprintStats;
+ $stats = new SprintStats();
$date = 'Thu Jan 1';
$date = $stats->getBurndownDate($date);
$this->assertInstanceOf('BurndownDataDate', $date);
}
public function testsumSprintStats() {
- $stats = new SprintStats;
+ $stats = new SprintStats();
$viewer = $this->generateNewTestUser();
$timezone = $stats->setTimezone($viewer);
$date = new DateTime();
$now = $date->format('U');
- $end = $now + $this->week_interval*2;
+ $end = $now + $this->week_interval * 2;
$timeseries = $stats->buildDateArray($now, $end, $timezone);
$dates = $stats->sumSprintStats($timeseries);
$this->assertInstanceOf('BurndownDataDate', array_pop($dates));
}
public function testsumTotalTasks() {
- $stats = new SprintStats;
+ $stats = new SprintStats();
$viewer = $this->generateNewTestUser();
$timezone = $stats->setTimezone($viewer);
$date = new DateTime();
$now = $date->format('U');
- $end = $now + $this->week_interval*2;
+ $end = $now + $this->week_interval * 2;
$timeseries = $stats->buildDateArray($now, $end, $timezone);
$dates = $stats->sumTotalTasks($timeseries);
$this->assertInstanceOf('BurndownDataDate', array_pop($dates));
}
public function testsumTotalPoints() {
- $stats = new SprintStats;
+ $stats = new SprintStats();
$viewer = $this->generateNewTestUser();
$timezone = $stats->setTimezone($viewer);
$date = new DateTime();
$now = $date->format('U');
- $end = $now + $this->week_interval*2;
+ $end = $now + $this->week_interval * 2;
$timeseries = $stats->buildDateArray($now, $end, $timezone);
$dates = $stats->sumTotalPoints($timeseries);
$this->assertInstanceOf('BurndownDataDate', array_pop($dates));
}
public function testcalcPointsRemaining() {
- $stats = new SprintStats;
+ $stats = new SprintStats();
$viewer = $this->generateNewTestUser();
$timezone = $stats->setTimezone($viewer);
$date = new DateTime();
$now = $date->format('U');
- $end = $now + $this->week_interval*2;
+ $end = $now + $this->week_interval * 2;
$timeseries = $stats->buildDateArray($now, $end, $timezone);
$dates = $stats->calcPointsRemaining($timeseries);
$this->assertInstanceOf('BurndownDataDate', array_pop($dates));
}
public function testcalcTasksRemaining() {
- $stats = new SprintStats;
+ $stats = new SprintStats();
$viewer = $this->generateNewTestUser();
$timezone = $stats->setTimezone($viewer);
$date = new DateTime();
$now = $date->format('U');
- $end = $now + $this->week_interval*2;
+ $end = $now + $this->week_interval * 2;
$timeseries = $stats->buildDateArray($now, $end, $timezone);
$dates = $stats->calcTasksRemaining($timeseries);
$this->assertInstanceOf('BurndownDataDate', array_pop($dates));
}
public function testcomputeIdealPoints() {
- $stats = new SprintStats;
+ $stats = new SprintStats();
$viewer = $this->generateNewTestUser();
$timezone = $stats->setTimezone($viewer);
$date = new DateTime();
$now = $date->format('U');
- $end = $now + $this->week_interval*2;
+ $end = $now + $this->week_interval * 2;
$timeseries = $stats->buildDateArray($now, $end, $timezone);
$dates = $stats->computeIdealPoints($timeseries);
$this->assertInstanceOf('BurndownDataDate', array_pop($dates));
}
public function testbuildDataSet() {
- $stats = new SprintStats;
+ $stats = new SprintStats();
$viewer = $this->generateNewTestUser();
$timezone = $stats->setTimezone($viewer);
$date = new DateTime();
$now = $date->format('U');
- $end = $now + $this->week_interval*2;
+ $end = $now + $this->week_interval * 2;
$timeseries = $stats->buildDateArray($now, $end, $timezone);
- $series = array('Start Points','Remaining Points','Ideal Points','Points Closed Today');
+ $series = array('Start Points', 'Remaining Points', 'Ideal Points', 'Points Closed Today');
$data = $stats->buildDataSet($timeseries);
$this->assertEquals($series, $data[0]);
}
-} \ No newline at end of file
+}
+
diff --git a/src/tests/bootstrap.php b/src/tests/bootstrap.php
index b4fbd4c..0f0ed8d 100644
--- a/src/tests/bootstrap.php
+++ b/src/tests/bootstrap.php
@@ -1,13 +1,13 @@
<?php
$root = dirname(dirname(__FILE__));
-require_once $root. '/constants/SprintConstants.php';
-require_once $root. '/tests/Autoloader.php';
-require_once(SprintConstants::LIBPHUTIL_ROOT_DIR . '/src/internationalization/pht.php');
-require_once(SprintConstants::LIBPHUTIL_ROOT_DIR . '/src/utils/utils.php');
-require_once(SprintConstants::LIBPHUTIL_ROOT_DIR . '/src/moduleutils/core.php');
-require_once(SprintConstants::LIBPHUTIL_ROOT_DIR . '/src/moduleutils/moduleutils.php');
+require_once $root.'/constants/SprintConstants.php';
+require_once $root.'/tests/Autoloader.php';
+require_once SprintConstants::LIBPHUTIL_ROOT_DIR . '/src/internationalization/pht.php';
+require_once SprintConstants::LIBPHUTIL_ROOT_DIR . '/src/utils/utils.php';
+require_once SprintConstants::LIBPHUTIL_ROOT_DIR . '/src/moduleutils/core.php';
+require_once SprintConstants::LIBPHUTIL_ROOT_DIR . '/src/moduleutils/moduleutils.php';
require_once SprintConstants::LIBPHUTIL_ROOT_DIR.'/src/markup/render.php';
AutoLoader::registerDirectory($root);
AutoLoader::registerDirectory(SprintConstants::PHABRICATOR_ROOT_DIR);
-AutoLoader::registerDirectory(SprintConstants::LIBPHUTIL_ROOT_DIR );
+AutoLoader::registerDirectory(SprintConstants::LIBPHUTIL_ROOT_DIR);
diff --git a/src/tests/phpunit.xml b/src/tests/phpunit.xml
index 229ac6c..23b92ed 100644
--- a/src/tests/phpunit.xml
+++ b/src/tests/phpunit.xml
@@ -30,4 +30,5 @@
<log type="testdox-html" target="/tmp/testdox.html"/>
<log type="testdox-text" target="/tmp/testdox.txt"/>
</logging>
-</phpunit> \ No newline at end of file
+</phpunit>
+
diff --git a/src/view/burndown/BoardDataPieView.php b/src/view/burndown/BoardDataPieView.php
index 3b7d793..3674893 100644
--- a/src/view/burndown/BoardDataPieView.php
+++ b/src/view/burndown/BoardDataPieView.php
@@ -32,12 +32,14 @@ final class BoardDataPieView {
'style' => 'width: 500px; height:200px; padding-left: 75px;
margin-left: 900px;',
), pht('Task Priority'));
+
$box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Points Allocation Report for '.
$project_name))
->appendChild($boardpie)
->appendChild($taskpie)
->appendChild($priority_pie);
+
return $box;
}