Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Art4 committed Oct 9, 2023
1 parent 8358b48 commit a31c99d
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
use stdClass;

/**
* Tests for IssueCategory::list()
* Tests for IssueCategory::listByProject()
*/
class ListTest extends TestCase
class ListByProjectTest extends TestCase
{
/**
* @covers \Redmine\Api\IssueCategory::list
* @covers \Redmine\Api\IssueCategory::listByProject
*/
public function testListWithoutParametersReturnsResponse()
public function testListByProjectWithoutParametersReturnsResponse()
{
// Test values
$projectId = 5;
Expand All @@ -43,13 +43,13 @@ public function testListWithoutParametersReturnsResponse()
$api = new IssueCategory($client);

// Perform the tests
$this->assertSame($expectedReturn, $api->list($projectId));
$this->assertSame($expectedReturn, $api->listByProject($projectId));
}

/**
* @covers \Redmine\Api\IssueCategory::list
* @covers \Redmine\Api\IssueCategory::listByProject
*/
public function testListWithParametersReturnsResponse()
public function testListByProjectWithParametersReturnsResponse()
{
// Test values
$projectId = 'project-slug';
Expand Down Expand Up @@ -79,22 +79,22 @@ public function testListWithParametersReturnsResponse()
$api = new IssueCategory($client);

// Perform the tests
$this->assertSame($expectedReturn, $api->list($projectId, $parameters));
$this->assertSame($expectedReturn, $api->listByProject($projectId, $parameters));
}

/**
* @covers \Redmine\Api\IssueCategory::list
* @covers \Redmine\Api\IssueCategory::listByProject
*
* @dataProvider getInvalidProjectIdentifiers
*/
public function testListWithWrongProjectIdentifierThrowsException($projectIdentifier)
public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier)
{
$api = new IssueCategory(MockClient::create());

$this->expectException(InvalidParameterException::class);
$this->expectExceptionMessage('Redmine\Api\IssueCategory::list(): Argument #1 ($projectIdentifier) must be of type int or string');
$this->expectExceptionMessage('Redmine\Api\IssueCategory::listByProject(): Argument #1 ($projectIdentifier) must be of type int or string');

$api->list($projectIdentifier);
$api->listByProject($projectIdentifier);
}

public static function getInvalidProjectIdentifiers(): array
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Api/IssueCategoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testAllTriggersDeprecationWarning()
set_error_handler(
function ($errno, $errstr): bool {
$this->assertSame(
'`Redmine\Api\IssueCategory::all()` is deprecated since v2.4.0, use `Redmine\Api\IssueCategory::list()` instead.',
'`Redmine\Api\IssueCategory::all()` is deprecated since v2.4.0, use `Redmine\Api\IssueCategory::listByProject()` instead.',
$errstr
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
use Redmine\Client\Client;

/**
* Tests for IssueRelation::list()
* Tests for IssueRelation::listByIssueId()
*/
class ListTest extends TestCase
class ListByIssueIdTest extends TestCase
{
/**
* @covers \Redmine\Api\IssueRelation::list
* @covers \Redmine\Api\IssueRelation::listByIssueId
*/
public function testListWithoutParametersReturnsResponse()
public function testListByIssueIdWithoutParametersReturnsResponse()
{
// Test values
$response = '["API Response"]';
Expand All @@ -39,13 +39,13 @@ public function testListWithoutParametersReturnsResponse()
$api = new IssueRelation($client);

// Perform the tests
$this->assertSame($expectedReturn, $api->list(5));
$this->assertSame($expectedReturn, $api->listByIssueId(5));
}

/**
* @covers \Redmine\Api\IssuePriority::list
* @covers \Redmine\Api\IssueRelation::listByIssueId
*/
public function testListWithParametersReturnsResponse()
public function testListByIssueIdWithParametersReturnsResponse()
{
// Test values
$parameters = ['not-used'];
Expand Down Expand Up @@ -74,6 +74,6 @@ public function testListWithParametersReturnsResponse()
$api = new IssueRelation($client);

// Perform the tests
$this->assertSame($expectedReturn, $api->list(5, $parameters));
$this->assertSame($expectedReturn, $api->listByIssueId(5, $parameters));
}
}
2 changes: 1 addition & 1 deletion tests/Unit/Api/IssueRelationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testAllTriggersDeprecationWarning()
set_error_handler(
function ($errno, $errstr): bool {
$this->assertSame(
'`Redmine\Api\IssueRelation::all()` is deprecated since v2.4.0, use `Redmine\Api\IssueRelation::list()` instead.',
'`Redmine\Api\IssueRelation::all()` is deprecated since v2.4.0, use `Redmine\Api\IssueRelation::listByIssueId()` instead.',
$errstr
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
use stdClass;

/**
* Tests for Membership::list()
* Tests for Membership::listByProject()
*/
class ListTest extends TestCase
class ListByProjectTest extends TestCase
{
/**
* @covers \Redmine\Api\Membership::list
* @covers \Redmine\Api\Membership::listByProject
*/
public function testListWithoutParametersReturnsResponse()
public function testListByProjectWithoutParametersReturnsResponse()
{
// Test values
$response = '["API Response"]';
Expand All @@ -42,13 +42,13 @@ public function testListWithoutParametersReturnsResponse()
$api = new Membership($client);

// Perform the tests
$this->assertSame($expectedReturn, $api->list(5));
$this->assertSame($expectedReturn, $api->listByProject(5));
}

/**
* @covers \Redmine\Api\Membership::list
* @covers \Redmine\Api\Membership::listByProject
*/
public function testListWithParametersReturnsResponse()
public function testListByProjectWithParametersReturnsResponse()
{
// Test values
$parameters = ['not-used'];
Expand Down Expand Up @@ -77,22 +77,22 @@ public function testListWithParametersReturnsResponse()
$api = new Membership($client);

// Perform the tests
$this->assertSame($expectedReturn, $api->list('project-slug', $parameters));
$this->assertSame($expectedReturn, $api->listByProject('project-slug', $parameters));
}

/**
* @covers \Redmine\Api\Membership::list
* @covers \Redmine\Api\Membership::listByProject
*
* @dataProvider getInvalidProjectIdentifiers
*/
public function testListWithWrongProjectIdentifierThrowsException($projectIdentifier)
public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier)
{
$api = new Membership(MockClient::create());

$this->expectException(InvalidParameterException::class);
$this->expectExceptionMessage('Redmine\Api\Membership::list(): Argument #1 ($projectIdentifier) must be of type int or string');
$this->expectExceptionMessage('Redmine\Api\Membership::listByProject(): Argument #1 ($projectIdentifier) must be of type int or string');

$api->list($projectIdentifier);
$api->listByProject($projectIdentifier);
}

public static function getInvalidProjectIdentifiers(): array
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Api/MembershipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testAllTriggersDeprecationWarning()
set_error_handler(
function ($errno, $errstr): bool {
$this->assertSame(
'`Redmine\Api\Membership::all()` is deprecated since v2.4.0, use `Redmine\Api\Membership::list()` instead.',
'`Redmine\Api\Membership::all()` is deprecated since v2.4.0, use `Redmine\Api\Membership::listByProject()` instead.',
$errstr
);

Expand Down

0 comments on commit a31c99d

Please sign in to comment.