Skip to content
This repository was archived by the owner on Jul 12, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@
}
],
"autoload": {
"psr-0": {
"YouTrack\\": "./"
"psr-4": {
"YouTrack\\": "YouTrack/"
}
},
"autoload-dev": {
"psr-4": {
"YouTrack\\Test\\": "test/"
}
},
"require": {
Expand Down
8 changes: 4 additions & 4 deletions test/AgileBoardSettingTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
namespace YouTrack;
require_once 'requirements.php';
require_once 'testconnection.php';

namespace YouTrack\Test;

use YouTrack\AgileSetting;

/**
* Unit test for the youtrack agile board settings class.
Expand All @@ -12,7 +12,7 @@
class AgileBoardSettingTest extends \PHPUnit_Framework_TestCase
{

private $singleAgileSettingFile = 'test/testdata/agile-boards.xml';
private $singleAgileSettingFile = __DIR__ . '/testdata/agile-boards.xml';

public function testCanCreateSimpleAgileSetting()
{
Expand Down
18 changes: 9 additions & 9 deletions test/AttachmentTest.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
namespace YouTrack;
require_once 'requirements.php';
require_once 'testconnection.php';

namespace YouTrack\Test;

use YouTrack\Attachment;

/**
* Unit test for the youtrack attachment class.
*
* @author Nepomuk Fraedrich <info@nepda.eu>
*/
class AttachmentsTest extends \PHPUnit_Framework_TestCase
class AttachmentTest extends \PHPUnit_Framework_TestCase
{

private $singleAttachmentFile = 'test/testdata/attachment.xml';
private $singleAttachmentFile = __DIR__ . '/testdata/attachment.xml';

public function testCanCreateSimpleAttachment()
{
Expand Down Expand Up @@ -99,12 +99,12 @@ public function testCreateAttachmentFromAttachment()
{
$attachment = $this->createAttachment();

$expectedResult = unserialize(file_get_contents('test/testdata/request-response-create-attachment-serialized.txt'));
$expectedResult = unserialize(file_get_contents(__DIR__ . '/testdata/request-response-create-attachment-serialized.txt'));

/**
* @var \YouTrack\Connection $youtrack
*/
$youtrackBuilder = $this->getMockBuilder('\\YouTrack\\TestConnection');
$youtrackBuilder = $this->getMockBuilder('YouTrack\\Test\\TestConnection');
$youtrackBuilder->setMethods(['request']);
$youtrack = $youtrackBuilder->getMock();

Expand Down Expand Up @@ -141,7 +141,7 @@ public function testCreateAttachment($name, $authorLogin, $created, $group, $par
$expectedUrl = '/issue/' . rawurlencode($issueId) . '/attachment?' . http_build_query($params);
$expectedResult = 'myResponseValue';

$youtrackBuilder = $this->getMockBuilder('\\YouTrack\\TestConnection');
$youtrackBuilder = $this->getMockBuilder('YouTrack\\Test\\TestConnection');
$youtrackBuilder->setMethods(['request']);
$youtrack = $youtrackBuilder->getMock();

Expand All @@ -158,7 +158,7 @@ public function testCreateAttachment($name, $authorLogin, $created, $group, $par

public function testCreateAttachmentThrowsExceptionOnNonExistingFile()
{
$youtrackBuilder = $this->getMockBuilder('\\YouTrack\\TestConnection');
$youtrackBuilder = $this->getMockBuilder('YouTrack\\Test\\TestConnection');
$youtrackBuilder->setMethods(['request']);
$youtrack = $youtrackBuilder->getMock();

Expand Down
3 changes: 2 additions & 1 deletion test/AutoloadingTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace YouTrack;

namespace YouTrack\Test;

class AutoloadingTest extends \PHPUnit_Framework_TestCase
{
Expand Down
6 changes: 3 additions & 3 deletions test/BaseObjectTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace YouTrack;
namespace YouTrack\Test;

require_once 'requirements.php';
use YouTrack\BaseObject;

/**
* Unit test for the youtrack object class.
Expand All @@ -12,7 +12,7 @@
class BaseObjectTest extends \PHPUnit_Framework_TestCase
{

private $filename = 'test/testdata/issue.xml';
private $filename = __DIR__ . '/testdata/issue.xml';

public function testConstruct01()
{
Expand Down
10 changes: 4 additions & 6 deletions test/ConnectionTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php

namespace YouTrack;
require_once 'requirements.php';
require_once 'testconnection.php';
namespace YouTrack\Test;

/**
* Unit test for the connection class.
Expand All @@ -16,16 +14,16 @@ class ConnectionTest extends \PHPUnit_Framework_TestCase
public function testCreateConnection()
{
$con = new TestConnection();
$this->assertInstanceOf('\YouTrack\TestConnection', $con);
$this->assertInstanceOf('YouTrack\Test\TestConnection', $con);
}

public function testIncorrectLoginThrowsException()
{
$con = new TestConnection();
$refl = new \ReflectionClass('\YouTrack\TestConnection');
$refl = new \ReflectionClass('YouTrack\Test\TestConnection');
$method = $refl->getMethod('handleLoginResponse');
$method->setAccessible(true);
$content = file_get_contents('test/testdata/incorrect-login.http');
$content = file_get_contents(__DIR__ . '/testdata/incorrect-login.http');
$response = [
'http_code' => 403
];
Expand Down
7 changes: 4 additions & 3 deletions test/CurrentUserTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace YouTrack;
require_once 'requirements.php';
namespace YouTrack\Test;

use YouTrack\CurrentUser;

/**
* Unit test for fetching current user.
Expand All @@ -9,7 +10,7 @@
*/
class CurrentUserTest extends \PHPUnit_Framework_TestCase
{
private $filename = 'test/testdata/currentuser.xml';
private $filename = __DIR__ . '/testdata/currentuser.xml';

public function testConstruct()
{
Expand Down
7 changes: 5 additions & 2 deletions test/EnumFieldTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<?php
namespace YouTrack;
namespace YouTrack\Test;

use YouTrack\EnumBundle;
use YouTrack\EnumField;

class EnumFieldTest extends \PHPUnit_Framework_TestCase
{

private $filename = 'test/testdata/enum_bundle.xml';
private $filename = __DIR__ . '/testdata/enum_bundle.xml';

public function testGetOwnedFieldBundleElements()
{
Expand Down
9 changes: 4 additions & 5 deletions test/ExceptionTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
namespace YouTrack;
require_once 'requirements.php';
namespace YouTrack\Test;

use YouTrack\Exception as YouTrackException;

Expand All @@ -19,7 +18,7 @@ public function testConstruct01()
'http_code' => 200,
];
$content = '';
$e = new Exception($url, $response, $content);
$e = new YouTrackException($url, $response, $content);
$this->assertEquals("Error for 'http://example.com': 200", $e->getMessage());
}

Expand All @@ -30,7 +29,7 @@ public function testConstruct02()
'http_code' => 404,
];
$content = '';
$e = new Exception($url, $response, $content);
$e = new YouTrackException($url, $response, $content);
$this->assertEquals("Error for 'http://example.com': 404", $e->getMessage());
}

Expand All @@ -42,7 +41,7 @@ public function testConstruct03()
'content_type' => 'text/html; charset=utf8',
];
$content = '';
$e = new Exception($url, $response, $content);
$e = new YouTrackException($url, $response, $content);
$this->assertEquals("Error for 'http://example.com': 500", $e->getMessage());
}

Expand Down
8 changes: 5 additions & 3 deletions test/IssueTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace YouTrack;
require_once 'requirements.php';
namespace YouTrack\Test;


use YouTrack\Issue;

/**
* Unit test for the youtrack issue class.
Expand All @@ -11,7 +13,7 @@
class IssueTest extends \PHPUnit_Framework_TestCase
{

private $filename = 'test/testdata/issue.xml';
private $filename = __DIR__ . '/testdata/issue.xml';

public function testConstruct01()
{
Expand Down
7 changes: 5 additions & 2 deletions test/OwnedFieldBundleTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<?php
namespace YouTrack;
namespace YouTrack\Test;

use YouTrack\OwnedField;
use YouTrack\OwnedFieldBundle;

class OwnedFieldBundleTest extends \PHPUnit_Framework_TestCase
{

private $filename = 'test/testdata/owned_field_bundle.xml';
private $filename = __DIR__ . '/testdata/owned_field_bundle.xml';

public function testGetOwnedFieldBundleElements()
{
Expand Down
9 changes: 5 additions & 4 deletions test/RoleTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php
namespace YouTrack;
namespace YouTrack\Test;

require_once 'requirements.php';

use YouTrack\Role;

/**
* Class RoleTest
Expand All @@ -11,8 +12,8 @@
class RoleTest extends \PHPUnit_Framework_TestCase
{

private $rolePlainFile = 'test/testdata/role-plain.xml';
private $roleProjectFile = 'test/testdata/role-project-ref.xml';
private $rolePlainFile = __DIR__ . '/testdata/role-plain.xml';
private $roleProjectFile = __DIR__ . '/testdata/role-project-ref.xml';

public function testCreatePlainRole()
{
Expand Down
4 changes: 3 additions & 1 deletion test/testconnection.php → test/TestConnection.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

namespace YouTrack;
namespace YouTrack\Test;

use YouTrack\Connection;

/**
* A helper class for connection testing.
Expand Down
7 changes: 4 additions & 3 deletions test/VersionTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace YouTrack;
require_once 'requirements.php';
namespace YouTrack\Test;

use YouTrack\Version;

/**
* Unit test for the YouTrack Version class.
Expand All @@ -11,7 +12,7 @@
class VersionTest extends \PHPUnit_Framework_TestCase
{

private $filename = 'test/testdata/version.xml';
private $filename = __DIR__ . '/testdata/version.xml';

public function testName()
{
Expand Down
8 changes: 5 additions & 3 deletions test/WorkitemTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace YouTrack;
require_once 'requirements.php';
namespace YouTrack\Test;

use YouTrack\User;
use YouTrack\Workitem;

/**
* Unit test for the youtrack workitem class.
Expand All @@ -9,7 +11,7 @@
*/
class WorkitemTest extends \PHPUnit_Framework_TestCase
{
private $filename = 'test/testdata/workitem.xml';
private $filename = __DIR__ . '/testdata/workitem.xml';

public function testConstruct01()
{
Expand Down
6 changes: 0 additions & 6 deletions test/requirements.php

This file was deleted.