Skip to content

Commit

Permalink
started writing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Wiatrogon committed Dec 12, 2016
1 parent d3786e0 commit d704838
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.buildpath
.project
.settings
vendor
composer.lock
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"psr-4": {
"Allegro\\REST\\": "src"
}
},
"require-dev": {
"phpunit/phpunit": "^5.7"
}
}
32 changes: 32 additions & 0 deletions tests/test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
require_once dirname(__DIR__) . '/src/Resource.php';
require_once dirname(__DIR__) . '/src/Api.php';

use PHPUnit\Framework\TestCase;

class ApiTest extends TestCase
{
function testGetUri()
{
$api = new Allegro\REST\Api('eggs', 'spam', 'ham', 'beans');

$this->assertEquals('https://allegroapi.io/',
$api->getUri());

$this->assertEquals('https://allegroapi.io/categories/',
$api->categories->getUri());

$this->assertEquals('https://allegroapi.io/categories/12/',
$api->categories(12)->getUri());
}

function testGetAutorizationUri()
{
$api = new Allegro\REST\Api('eggs', 'spam', 'ham', 'beans');

$this->assertEquals('https://ssl.allegro.pl/auth/oauth/authorize' .
'?response_type=code&client_id=eggs&api-key=ham&redirect_uri=beans',
$api->getAuthorizationUri());
}
}

0 comments on commit d704838

Please sign in to comment.