Skip to content

Commit ea400e3

Browse files
authored
Fix build #2 (#225)
* lib/ -> src/ * fix error in travis? * fix error in travis? * fix error in travis? * re-enable failing tests introduced in 45a4a86 #220
1 parent affcc27 commit ea400e3

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

src/Redmine/Api/Issue.php

-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ private function cleanParams(array $params = [])
234234
$apiProject = $this->client->project;
235235
$params['project_id'] = $apiProject->getIdByName($params['project']);
236236
unset($params['project']);
237-
238237
if (isset($params['category'])) {
239238
$apiIssueCategory = $this->client->issue_category;
240239
$params['category_id'] = $apiIssueCategory->getIdByName($params['project_id'], $params['category']);

tests/Unit/Api/IssueTest.php

+16-16
Original file line numberDiff line numberDiff line change
@@ -357,17 +357,12 @@ public function testCreateCallsPost()
357357
}
358358

359359
/**
360-
* DISABLED - can't figure out how to fix the failing test :
361-
* 1) Redmine\Tests\Unit\Api\IssueTest::testCreateCleansParameters
362-
* TypeError: Argument 2 passed to Mock_Project_b34aaea3::getIdByName() must be of the type array, string given, called in /home/kevin/workspace/me/php-redmine-api/src/Redmine/Api/Issue.php on line 241.
363-
*
364360
* Test cleanParams().
365361
*
366362
* @covers ::create
367363
* @covers ::cleanParams
368364
* @test
369365
*/
370-
/*
371366
public function testCreateCleansParameters()
372367
{
373368
// Test values
@@ -385,7 +380,13 @@ public function testCreateCleansParameters()
385380
$getIdByNameApi = $this->getMockBuilder('Redmine\Api\Project')
386381
->disableOriginalConstructor()
387382
->getMock();
388-
$getIdByNameApi->expects($this->exactly(4))
383+
$getIdByNameApi->expects($this->exactly(3))
384+
->method('getIdByName')
385+
->willReturn('cleanedValue');
386+
$issueCategoryGetIdByNameApi = $this->getMockBuilder('Redmine\Api\IssueCategory')
387+
->disableOriginalConstructor()
388+
->getMock();
389+
$issueCategoryGetIdByNameApi->expects($this->exactly(1))
389390
->method('getIdByName')
390391
->willReturn('cleanedValue');
391392
$getIdByUsernameApi = $this->getMockBuilder('Redmine\Api\User')
@@ -404,7 +405,7 @@ public function testCreateCleansParameters()
404405
->willReturnMap(
405406
[
406407
['project', $getIdByNameApi],
407-
['issue_category', $getIdByNameApi],
408+
['issue_category', $issueCategoryGetIdByNameApi],
408409
['issue_status', $getIdByNameApi],
409410
['tracker', $getIdByNameApi],
410411
['user', $getIdByUsernameApi],
@@ -434,7 +435,6 @@ public function testCreateCleansParameters()
434435
// Perform the tests
435436
$this->assertSame($getResponse, $api->create($parameters));
436437
}
437-
*/
438438

439439
/**
440440
* Test create() and buildXML().
@@ -523,17 +523,12 @@ public function testUpdateCallsPut()
523523
}
524524

525525
/**
526-
* DISABLED - can't figure out how to fix the failing test :
527-
* 2) Redmine\Tests\Unit\Api\IssueTest::testUpdateCleansParameters
528-
* TypeError: Argument 2 passed to Mock_Project_3a94a82c::getIdByName() must be of the type array, string given, called in /home/kevin/workspace/me/php-redmine-api/src/Redmine/Api/Issue.php on line 241.
529-
*
530526
* Test update().
531527
*
532528
* @covers ::update
533529
* @covers ::cleanParams
534530
* @test
535531
*/
536-
/*
537532
public function testUpdateCleansParameters()
538533
{
539534
// Test values
@@ -551,7 +546,13 @@ public function testUpdateCleansParameters()
551546
$getIdByNameApi = $this->getMockBuilder('Redmine\Api\Project')
552547
->disableOriginalConstructor()
553548
->getMock();
554-
$getIdByNameApi->expects($this->exactly(4))
549+
$getIdByNameApi->expects($this->exactly(3))
550+
->method('getIdByName')
551+
->willReturn('cleanedValue');
552+
$issueCategoryGetIdByNameApi = $this->getMockBuilder('Redmine\Api\IssueCategory')
553+
->disableOriginalConstructor()
554+
->getMock();
555+
$issueCategoryGetIdByNameApi->expects($this->exactly(1))
555556
->method('getIdByName')
556557
->willReturn('cleanedValue');
557558
$getIdByUsernameApi = $this->getMockBuilder('Redmine\Api\User')
@@ -570,7 +571,7 @@ public function testUpdateCleansParameters()
570571
->willReturnMap(
571572
[
572573
['project', $getIdByNameApi],
573-
['issue_category', $getIdByNameApi],
574+
['issue_category', $issueCategoryGetIdByNameApi],
574575
['issue_status', $getIdByNameApi],
575576
['tracker', $getIdByNameApi],
576577
['user', $getIdByUsernameApi],
@@ -601,7 +602,6 @@ public function testUpdateCleansParameters()
601602
// Perform the tests
602603
$this->assertSame($getResponse, $api->update(5, $parameters));
603604
}
604-
*/
605605

606606
/**
607607
* Test setIssueStatus().

0 commit comments

Comments
 (0)