Skip to content

Commit

Permalink
Added first test
Browse files Browse the repository at this point in the history
  • Loading branch information
kocsismate committed Sep 12, 2015
1 parent b43435d commit a19b0a3
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 13 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ matrix:
before_install:
- if [[ $EXECUTE_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
- composer self-update
- if [[ $EXECUTE_COVERAGE == 'true' ]]; then composer require --no-update satooshi/php-coveralls:dev-master ; fi

install:
- travis_retry composer install --no-interaction --ignore-platform-reqs
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
Expand Down
12 changes: 0 additions & 12 deletions tests/JsonApi/Schema/AttributesTest.php

This file was deleted.

31 changes: 31 additions & 0 deletions tests/JsonApi/Schema/LinkTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
namespace WoohooLabsTest\Yin\JsonApi\Schema;

use PHPUnit_Framework_TestCase;
use WoohooLabs\Yin\JsonApi\Schema\Link;

class LinkTest extends PHPUnit_Framework_TestCase
{
public function testGetHref()
{
$link = $this->createLink("http://example.com");
$this->assertEquals("http://example.com", $link->getHref());
}

public function testAbsoluteLinkTransform()
{
$link = $this->createLink("http://example.com");
$this->assertEquals("http://example.com", $link->transform(""));
}

public function testRelativeLinkTransform()
{
$link = $this->createLink("/api/users");
$this->assertEquals("http://example.com/api/users", $link->transform("http://example.com"));
}

private function createLink($href)
{
return new Link($href);
}
}

0 comments on commit a19b0a3

Please sign in to comment.