summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-06-26 11:57:28 -0400
committerFrederic Guillot <fred@kanboard.net>2016-06-26 11:57:28 -0400
commitb48c0cecbb1f687641594430260a67938d870cbb (patch)
tree82169826993d3d8c4790b653ce3901e152f6d4d8
parent4a230d331ec220fc32a48525afb308af0d9787fa (diff)
Added new arguments to project API calls and update composer.json
-rw-r--r--ChangeLog1
-rw-r--r--app/Api/Procedure/BaseProcedure.php1
-rw-r--r--app/Api/Procedure/ProjectProcedure.php6
-rw-r--r--app/Validator/ProjectValidator.php8
-rw-r--r--composer.json31
-rw-r--r--composer.lock297
-rw-r--r--doc/api-project-procedures.markdown2
-rw-r--r--doc/requirements.markdown2
-rw-r--r--tests/integration/ProjectProcedureTest.php29
-rw-r--r--tests/units/Validator/ProjectValidatorTest.php12
10 files changed, 143 insertions, 246 deletions
diff --git a/ChangeLog b/ChangeLog
index 42af8ee3..550a7ada 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@ New features:
Improvements:
+* Added argument owner_id and identifier to project API calls
* Rewrite integration tests to run with Docker containers
* Use the same task form layout everywhere
* Remove some tasks dropdown menus that are now available with task edit form
diff --git a/app/Api/Procedure/BaseProcedure.php b/app/Api/Procedure/BaseProcedure.php
index 0aa43428..e31b3027 100644
--- a/app/Api/Procedure/BaseProcedure.php
+++ b/app/Api/Procedure/BaseProcedure.php
@@ -2,7 +2,6 @@
namespace Kanboard\Api\Procedure;
-use JsonRPC\Exception\AccessDeniedException;
use Kanboard\Api\Authorization\ProcedureAuthorization;
use Kanboard\Api\Authorization\UserAuthorization;
use Kanboard\Core\Base;
diff --git a/app/Api/Procedure/ProjectProcedure.php b/app/Api/Procedure/ProjectProcedure.php
index 9187f221..fe6b63e2 100644
--- a/app/Api/Procedure/ProjectProcedure.php
+++ b/app/Api/Procedure/ProjectProcedure.php
@@ -78,17 +78,17 @@ class ProjectProcedure extends BaseProcedure
public function createProject($name, $description = null, $owner_id = 0, $identifier = null)
{
- $values = array(
+ $values = $this->filterValues(array(
'name' => $name,
'description' => $description,
'identifier' => $identifier,
- );
+ ));
list($valid, ) = $this->projectValidator->validateCreation($values);
return $valid ? $this->projectModel->create($values, $owner_id, $this->userSession->isLogged()) : false;
}
- public function updateProject($project_id, $name, $description = null, $owner_id = null, $identifier = null)
+ public function updateProject($project_id, $name = null, $description = null, $owner_id = null, $identifier = null)
{
ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'updateProject', $project_id);
diff --git a/app/Validator/ProjectValidator.php b/app/Validator/ProjectValidator.php
index 9ef59111..8c6117a4 100644
--- a/app/Validator/ProjectValidator.php
+++ b/app/Validator/ProjectValidator.php
@@ -28,7 +28,7 @@ class ProjectValidator extends BaseValidator
new Validators\Integer('priority_start', t('This value must be an integer')),
new Validators\Integer('priority_end', t('This value must be an integer')),
new Validators\Integer('is_active', t('This value must be an integer')),
- new Validators\Required('name', t('The project name is required')),
+ new Validators\NotEmpty('name', t('This field cannot be empty')),
new Validators\MaxLength('name', t('The maximum length is %d characters', 50), 50),
new Validators\MaxLength('identifier', t('The maximum length is %d characters', 50), 50),
new Validators\MaxLength('start_date', t('The maximum length is %d characters', 10), 10),
@@ -47,11 +47,15 @@ class ProjectValidator extends BaseValidator
*/
public function validateCreation(array $values)
{
+ $rules = array(
+ new Validators\Required('name', t('The project name is required')),
+ );
+
if (! empty($values['identifier'])) {
$values['identifier'] = strtoupper($values['identifier']);
}
- $v = new Validator($values, $this->commonValidationRules());
+ $v = new Validator($values, array_merge($this->commonValidationRules(), $rules));
return array(
$v->execute(),
diff --git a/composer.json b/composer.json
index bcac020e..d82f3f0c 100644
--- a/composer.json
+++ b/composer.json
@@ -14,7 +14,7 @@
"discard-changes": true
},
"require" : {
- "php" : ">=5.3.3",
+ "php" : ">=5.3.9",
"ext-gd" : "*",
"ext-mbstring" : "*",
"ext-hash" : "*",
@@ -23,21 +23,21 @@
"ext-ctype" : "*",
"ext-filter" : "*",
"ext-session" : "*",
- "christian-riesen/otp" : "1.4",
- "eluceo/ical": "0.8.0",
+ "christian-riesen/otp" : "1.4.3",
+ "eluceo/ical": "0.10.1",
"erusev/parsedown" : "1.6.0",
"fguillot/json-rpc" : "1.2.1",
"fguillot/picodb" : "1.0.12",
"fguillot/simpleLogger" : "1.0.1",
- "fguillot/simple-validator" : "1.0.0",
+ "fguillot/simple-validator" : "1.0.1",
"fguillot/simple-queue" : "1.0.1",
- "paragonie/random_compat": "@stable",
- "pimple/pimple" : "~3.0",
- "ramsey/array_column": "@stable",
- "swiftmailer/swiftmailer" : "~5.4",
- "symfony/console" : "~2.7",
- "symfony/event-dispatcher" : "~2.7",
- "gregwar/captcha": "1.*"
+ "paragonie/random_compat": "2.0.2",
+ "pimple/pimple" : "3.0.2",
+ "ramsey/array_column": "1.1.3",
+ "swiftmailer/swiftmailer" : "5.4.2",
+ "symfony/console" : "2.8.7",
+ "symfony/event-dispatcher" : "2.7.14",
+ "gregwar/captcha": "1.1.1"
},
"autoload" : {
"classmap" : ["app/"],
@@ -50,9 +50,10 @@
]
},
"require-dev" : {
- "symfony/yaml" : "2.1",
- "symfony/stopwatch" : "~2.6",
- "phpunit/phpunit" : "4.8.*",
- "phpunit/phpunit-selenium": "^2.0"
+ "phpdocumentor/reflection-docblock": "2.0.4",
+ "symfony/yaml": "2.8.7",
+ "symfony/stopwatch" : "2.6.13",
+ "phpunit/phpunit" : "4.8.26",
+ "phpunit/phpunit-selenium": "2.0.2"
}
}
diff --git a/composer.lock b/composer.lock
index e6a72582..03c5e523 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "283af0b856598f5bc3d8ee0b226959e5",
- "content-hash": "18c0bbff5406ceb8b567d9655de26746",
+ "hash": "ab5b2c960b3a6d9f93883606269085e0",
+ "content-hash": "bd5f17c3382d7f85e33a68023927704c",
"packages": [
{
"name": "christian-riesen/base32",
@@ -63,22 +63,25 @@
},
{
"name": "christian-riesen/otp",
- "version": "1.4",
+ "version": "1.4.3",
"source": {
"type": "git",
"url": "https://github.com/ChristianRiesen/otp.git",
- "reference": "a209b8bbd975d96d6b5287f8658562061adef1f8"
+ "reference": "20a539ce6280eb029030f4e7caefd5709a75e1ad"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/ChristianRiesen/otp/zipball/a209b8bbd975d96d6b5287f8658562061adef1f8",
- "reference": "a209b8bbd975d96d6b5287f8658562061adef1f8",
+ "url": "https://api.github.com/repos/ChristianRiesen/otp/zipball/20a539ce6280eb029030f4e7caefd5709a75e1ad",
+ "reference": "20a539ce6280eb029030f4e7caefd5709a75e1ad",
"shasum": ""
},
"require": {
"christian-riesen/base32": ">=1.0",
"php": ">=5.3.0"
},
+ "suggest": {
+ "paragonie/random_compat": "Optional polyfill for a more secure random generator for pre PHP7 versions"
+ },
"type": "library",
"autoload": {
"psr-0": {
@@ -107,20 +110,20 @@
"rfc6238",
"totp"
],
- "time": "2015-02-12 09:11:49"
+ "time": "2015-10-08 08:17:59"
},
{
"name": "eluceo/ical",
- "version": "0.8.0",
+ "version": "0.10.1",
"source": {
"type": "git",
"url": "https://github.com/markuspoerschke/iCal.git",
- "reference": "a291711851d1538e2726ffe95862aa5e340ddb9a"
+ "reference": "2dd99c12c0aa961c541380ab0c113135e14af33e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/markuspoerschke/iCal/zipball/a291711851d1538e2726ffe95862aa5e340ddb9a",
- "reference": "a291711851d1538e2726ffe95862aa5e340ddb9a",
+ "url": "https://api.github.com/repos/markuspoerschke/iCal/zipball/2dd99c12c0aa961c541380ab0c113135e14af33e",
+ "reference": "2dd99c12c0aa961c541380ab0c113135e14af33e",
"shasum": ""
},
"require": {
@@ -160,7 +163,7 @@
"ics",
"php calendar"
],
- "time": "2015-07-12 18:19:30"
+ "time": "2016-06-09 09:08:55"
},
{
"name": "erusev/parsedown",
@@ -331,16 +334,16 @@
},
{
"name": "fguillot/simple-validator",
- "version": "1.0.0",
+ "version": "v1.0.1",
"source": {
"type": "git",
"url": "https://github.com/fguillot/simpleValidator.git",
- "reference": "9579993f3dd0f03053b28fec1e7b9990edc3947b"
+ "reference": "23b0a99c5f11ad74d05f8845feaafbcfd9223eda"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/fguillot/simpleValidator/zipball/9579993f3dd0f03053b28fec1e7b9990edc3947b",
- "reference": "9579993f3dd0f03053b28fec1e7b9990edc3947b",
+ "url": "https://api.github.com/repos/fguillot/simpleValidator/zipball/23b0a99c5f11ad74d05f8845feaafbcfd9223eda",
+ "reference": "23b0a99c5f11ad74d05f8845feaafbcfd9223eda",
"shasum": ""
},
"require": {
@@ -363,7 +366,7 @@
],
"description": "Simple validator library",
"homepage": "https://github.com/fguillot/simpleValidator",
- "time": "2015-08-29 00:44:37"
+ "time": "2016-06-26 15:09:26"
},
{
"name": "fguillot/simpleLogger",
@@ -742,16 +745,16 @@
},
{
"name": "symfony/event-dispatcher",
- "version": "v2.8.7",
+ "version": "v2.7.14",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
- "reference": "2a6b8713f8bdb582058cfda463527f195b066110"
+ "reference": "d3e09ed1224503791f31b913d22196f65f9afed5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/2a6b8713f8bdb582058cfda463527f195b066110",
- "reference": "2a6b8713f8bdb582058cfda463527f195b066110",
+ "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d3e09ed1224503791f31b913d22196f65f9afed5",
+ "reference": "d3e09ed1224503791f31b913d22196f65f9afed5",
"shasum": ""
},
"require": {
@@ -759,10 +762,10 @@
},
"require-dev": {
"psr/log": "~1.0",
- "symfony/config": "~2.0,>=2.0.5|~3.0.0",
- "symfony/dependency-injection": "~2.6|~3.0.0",
- "symfony/expression-language": "~2.6|~3.0.0",
- "symfony/stopwatch": "~2.3|~3.0.0"
+ "symfony/config": "~2.0,>=2.0.5",
+ "symfony/dependency-injection": "~2.6",
+ "symfony/expression-language": "~2.6",
+ "symfony/stopwatch": "~2.3"
},
"suggest": {
"symfony/dependency-injection": "",
@@ -771,7 +774,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.8-dev"
+ "dev-master": "2.7-dev"
}
},
"autoload": {
@@ -798,7 +801,7 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
- "time": "2016-06-06 11:11:27"
+ "time": "2016-06-06 11:03:51"
},
{
"name": "symfony/polyfill-mbstring",
@@ -916,135 +919,38 @@
"time": "2015-06-14 21:17:01"
},
{
- "name": "phpdocumentor/reflection-common",
- "version": "1.0",
- "source": {
- "type": "git",
- "url": "https://github.com/phpDocumentor/ReflectionCommon.git",
- "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
- "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
- "shasum": ""
- },
- "require": {
- "php": ">=5.5"
- },
- "require-dev": {
- "phpunit/phpunit": "^4.6"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "phpDocumentor\\Reflection\\": [
- "src"
- ]
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jaap van Otterdijk",
- "email": "opensource@ijaap.nl"
- }
- ],
- "description": "Common reflection classes used by phpdocumentor to reflect the code structure",
- "homepage": "http://www.phpdoc.org",
- "keywords": [
- "FQSEN",
- "phpDocumentor",
- "phpdoc",
- "reflection",
- "static analysis"
- ],
- "time": "2015-12-27 11:43:31"
- },
- {
"name": "phpdocumentor/reflection-docblock",
- "version": "3.1.0",
+ "version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
- "reference": "9270140b940ff02e58ec577c237274e92cd40cdd"
+ "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9270140b940ff02e58ec577c237274e92cd40cdd",
- "reference": "9270140b940ff02e58ec577c237274e92cd40cdd",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8",
+ "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8",
"shasum": ""
},
"require": {
- "php": ">=5.5",
- "phpdocumentor/reflection-common": "^1.0@dev",
- "phpdocumentor/type-resolver": "^0.2.0",
- "webmozart/assert": "^1.0"
+ "php": ">=5.3.3"
},
"require-dev": {
- "mockery/mockery": "^0.9.4",
- "phpunit/phpunit": "^4.4"
- },
- "type": "library",
- "autoload": {
- "psr-4": {
- "phpDocumentor\\Reflection\\": [
- "src/"
- ]
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Mike van Riel",
- "email": "me@mikevanriel.com"
- }
- ],
- "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
- "time": "2016-06-10 09:48:41"
- },
- {
- "name": "phpdocumentor/type-resolver",
- "version": "0.2",
- "source": {
- "type": "git",
- "url": "https://github.com/phpDocumentor/TypeResolver.git",
- "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443",
- "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443",
- "shasum": ""
- },
- "require": {
- "php": ">=5.5",
- "phpdocumentor/reflection-common": "^1.0"
+ "phpunit/phpunit": "~4.0"
},
- "require-dev": {
- "mockery/mockery": "^0.9.4",
- "phpunit/phpunit": "^5.2||^4.8.24"
+ "suggest": {
+ "dflydev/markdown": "~1.0",
+ "erusev/parsedown": "~1.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.0.x-dev"
+ "dev-master": "2.0.x-dev"
}
},
"autoload": {
- "psr-4": {
- "phpDocumentor\\Reflection\\": [
+ "psr-0": {
+ "phpDocumentor": [
"src/"
]
}
@@ -1056,10 +962,10 @@
"authors": [
{
"name": "Mike van Riel",
- "email": "me@mikevanriel.com"
+ "email": "mike.vanriel@naenius.com"
}
],
- "time": "2016-06-10 07:14:17"
+ "time": "2015-02-03 12:10:50"
},
{
"name": "phpspec/prophecy",
@@ -1932,34 +1838,35 @@
},
{
"name": "symfony/stopwatch",
- "version": "v2.8.7",
+ "version": "v2.6.13",
+ "target-dir": "Symfony/Component/Stopwatch",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
- "reference": "5e628055488bcc42dbace3af65be435d094e37e4"
+ "reference": "a0d91f2f4e2c60bd78f13388aa68f9d7cab8c987"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5e628055488bcc42dbace3af65be435d094e37e4",
- "reference": "5e628055488bcc42dbace3af65be435d094e37e4",
+ "url": "https://api.github.com/repos/symfony/stopwatch/zipball/a0d91f2f4e2c60bd78f13388aa68f9d7cab8c987",
+ "reference": "a0d91f2f4e2c60bd78f13388aa68f9d7cab8c987",
"shasum": ""
},
"require": {
- "php": ">=5.3.9"
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "symfony/phpunit-bridge": "~2.7"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.8-dev"
+ "dev-master": "2.6-dev"
}
},
"autoload": {
- "psr-4": {
+ "psr-0": {
"Symfony\\Component\\Stopwatch\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
+ }
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -1977,36 +1884,38 @@
],
"description": "Symfony Stopwatch Component",
"homepage": "https://symfony.com",
- "time": "2016-06-06 11:11:27"
+ "time": "2015-07-01 18:23:01"
},
{
"name": "symfony/yaml",
- "version": "v2.1.0",
- "target-dir": "Symfony/Component/Yaml",
+ "version": "v2.8.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "f18e004fc975707bb4695df1dbbe9b0d8c8b7715"
+ "reference": "815fabf3f48c7d1df345a69d1ad1a88f59757b34"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/f18e004fc975707bb4695df1dbbe9b0d8c8b7715",
- "reference": "f18e004fc975707bb4695df1dbbe9b0d8c8b7715",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/815fabf3f48c7d1df345a69d1ad1a88f59757b34",
+ "reference": "815fabf3f48c7d1df345a69d1ad1a88f59757b34",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "php": ">=5.3.9"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.1-dev"
+ "dev-master": "2.8-dev"
}
},
"autoload": {
- "psr-0": {
- "Symfony\\Component\\Yaml": ""
- }
+ "psr-4": {
+ "Symfony\\Component\\Yaml\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -2014,78 +1923,26 @@
],
"authors": [
{
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- },
- {
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
- }
- ],
- "description": "Symfony Yaml Component",
- "homepage": "http://symfony.com",
- "time": "2012-08-22 13:48:41"
- },
- {
- "name": "webmozart/assert",
- "version": "1.0.2",
- "source": {
- "type": "git",
- "url": "https://github.com/webmozart/assert.git",
- "reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/webmozart/assert/zipball/30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde",
- "reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "^4.6"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Webmozart\\Assert\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
+ },
{
- "name": "Bernhard Schussek",
- "email": "bschussek@gmail.com"
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
}
],
- "description": "Assertions to validate method input/output with nice error messages.",
- "keywords": [
- "assert",
- "check",
- "validate"
- ],
- "time": "2015-08-24 13:29:44"
+ "description": "Symfony Yaml Component",
+ "homepage": "https://symfony.com",
+ "time": "2016-06-06 11:11:27"
}
],
"aliases": [],
"minimum-stability": "stable",
- "stability-flags": {
- "paragonie/random_compat": 0,
- "ramsey/array_column": 0
- },
+ "stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
- "php": ">=5.3.3",
+ "php": ">=5.3.9",
"ext-gd": "*",
"ext-mbstring": "*",
"ext-hash": "*",
diff --git a/doc/api-project-procedures.markdown b/doc/api-project-procedures.markdown
index 3f8d33c2..d375852c 100644
--- a/doc/api-project-procedures.markdown
+++ b/doc/api-project-procedures.markdown
@@ -186,7 +186,7 @@ Response example:
- Purpose: **Update a project**
- Parameters:
- **project_id** (integer, required)
- - **name** (string, required)
+ - **name** (string, optional)
- **description** (string, optional)
- **owner_id** (integer, optional)
- **identifier** (string, optional)
diff --git a/doc/requirements.markdown b/doc/requirements.markdown
index 9943465a..f6c9b309 100644
--- a/doc/requirements.markdown
+++ b/doc/requirements.markdown
@@ -51,7 +51,7 @@ Kanboard is pre-configured to work with Apache (URL rewriting).
| PHP Version |
|----------------|
-| PHP >= 5.3.3 |
+| PHP >= 5.3.9 |
| PHP 5.4 |
| PHP 5.5 |
| PHP 5.6 |
diff --git a/tests/integration/ProjectProcedureTest.php b/tests/integration/ProjectProcedureTest.php
index 1ebd48ae..a4b65241 100644
--- a/tests/integration/ProjectProcedureTest.php
+++ b/tests/integration/ProjectProcedureTest.php
@@ -13,6 +13,8 @@ class ProjectProcedureTest extends BaseProcedureTest
$this->assertGetProjectByName();
$this->assertGetAllProjects();
$this->assertUpdateProject();
+ $this->assertUpdateProjectIdentifier();
+ $this->assertCreateProjectWithIdentifier();
$this->assertGetProjectActivity();
$this->assertGetProjectsActivity();
$this->assertEnableDisableProject();
@@ -69,6 +71,33 @@ class ProjectProcedureTest extends BaseProcedureTest
$this->assertTrue($this->app->updateProject(array('project_id' => $this->projectId, 'name' => $this->projectName)));
}
+ public function assertUpdateProjectIdentifier()
+ {
+ $this->assertTrue($this->app->updateProject(array(
+ 'project_id' => $this->projectId,
+ 'identifier' => 'MYPROJECT',
+ )));
+
+ $project = $this->app->getProjectById($this->projectId);
+ $this->assertNotNull($project);
+ $this->assertEquals($this->projectName, $project['name']);
+ $this->assertEquals('MYPROJECT', $project['identifier']);
+ }
+
+ public function assertCreateProjectWithIdentifier()
+ {
+ $projectId = $this->app->createProject(array(
+ 'name' => 'My project with an identifier',
+ 'identifier' => 'MYPROJECTWITHIDENTIFIER',
+ ));
+
+ $this->assertNotFalse($projectId);
+
+ $project = $this->app->getProjectById($projectId);
+ $this->assertEquals('My project with an identifier', $project['name']);
+ $this->assertEquals('MYPROJECTWITHIDENTIFIER', $project['identifier']);
+ }
+
public function assertEnableDisableProject()
{
$this->assertTrue($this->app->disableProject($this->projectId));
diff --git a/tests/units/Validator/ProjectValidatorTest.php b/tests/units/Validator/ProjectValidatorTest.php
index 07de6c25..e1e2f077 100644
--- a/tests/units/Validator/ProjectValidatorTest.php
+++ b/tests/units/Validator/ProjectValidatorTest.php
@@ -55,13 +55,19 @@ class ProjectValidatorTest extends Base
$r = $validator->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => 'TEST1'));
$this->assertTrue($r[0]);
- $r = $validator->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => 'test3'));
+ $r = $validator->validateModification(array('id' => 1, 'identifier' => 'test3'));
$this->assertTrue($r[0]);
- $r = $validator->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => ''));
+ $r = $validator->validateModification(array('id' => 1, 'identifier' => ''));
$this->assertTrue($r[0]);
- $r = $validator->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => 'TEST2'));
+ $r = $validator->validateModification(array('id' => 1, 'identifier' => 'TEST2'));
+ $this->assertFalse($r[0]);
+
+ $r = $validator->validateModification(array('id' => 1, 'name' => ''));
+ $this->assertFalse($r[0]);
+
+ $r = $validator->validateModification(array('id' => 1, 'name' => null));
$this->assertFalse($r[0]);
}
}