Skip to content

Commit

Permalink
Merge pull request #445 from heiglandreas/updateToPHPUnit6+
Browse files Browse the repository at this point in the history
Adapt tests to work with PHPUnit > 5
  • Loading branch information
iansltx authored Feb 11, 2019
2 parents 078d380 + 0969710 commit 0f70ae5
Show file tree
Hide file tree
Showing 18 changed files with 55 additions and 22 deletions.
3 changes: 2 additions & 1 deletion tests/controllers/EventHostsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace JoindinTest\Controller;

use Mockery as M;
use PHPUnit\Framework\TestCase;

class EventHostsControllerTest extends \PHPUnit_Framework_TestCase
class EventHostsControllerTest extends TestCase
{
/**
* @expectedException \Exception
Expand Down
3 changes: 2 additions & 1 deletion tests/controllers/TalkBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
use TalkMapper;
use TalkModel;
use UserMapper;
use PHPUnit\Framework\TestCase;

class TalkBase extends PHPUnit_Framework_TestCase
class TalkBase extends TestCase
{
protected function createTalkMapper(mockPDO $db, Request $request, $expetcedCalls = 1)
{
Expand Down
4 changes: 3 additions & 1 deletion tests/controllers/TokenControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace JoindinTest\Controller;

class TokenControllerTest extends \PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;

class TokenControllerTest extends TestCase
{
private $request;

Expand Down
4 changes: 3 additions & 1 deletion tests/controllers/UsersControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace JoindinTest\Controller;

class UsersControllerTest extends \PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;

class UsersControllerTest extends TestCase
{

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/inc/HeaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@

namespace JoindinTest\Inc;

use PHPUnit\Framework\TestCase;

require_once __DIR__ . '/../../src/inc/Header.php';

class HeaderTest extends \PHPUnit_Framework_TestCase
class HeaderTest extends TestCase
{

public function testParseParamsWithEmbededSeparator()
Expand Down
4 changes: 3 additions & 1 deletion tests/inc/RequestTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php
namespace JoindinTest\Inc;

use PHPUnit\Framework\TestCase;

require_once __DIR__ . '/../../src/inc/Request.php';

class RequestTest extends \PHPUnit_Framework_TestCase
class RequestTest extends TestCase
{
/**
* Make sure we have everything we need - in this case the config
Expand Down
12 changes: 7 additions & 5 deletions tests/inc/TalkCommentEmailServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
namespace JoindinTest\Inc;

use TalkModel;
use TalkCommentEmailService;
use PHPUnit\Framework\TestCase;

require_once __DIR__.'/../../src/services/TalkCommentEmailService.php';

class TalkCommentEmailServiceTest extends \PHPUnit_Framework_Testcase
class TalkCommentEmailServiceTest extends Testcase
{

protected $config = [
Expand All @@ -33,7 +35,7 @@ public function createService()
$talk = new TalkModel(["talk_title" => "sample talk"]);
$comment = ["comments" => [["comment" => "test comment", "rating" => 3]]];

$service = new \TalkCommentEmailService($this->config, $recipients, $talk, $comment);
$service = new TalkCommentEmailService($this->config, $recipients, $talk, $comment);
$this->assertInstanceOf('TalkCommentEmailService', $service);
}

Expand All @@ -50,7 +52,7 @@ public function createServiceWithEmailRedirect()
$talk = new TalkModel(["talk_title" => "sample talk"]);
$comment = ["comments" => [["comment" => "test comment", "rating" => 3]]];

$service = new \TalkCommentEmailService($config, $recipients, $talk, $comment);
$service = new TalkCommentEmailService($config, $recipients, $talk, $comment);
$this->assertEquals(["[email protected]"], $service->getRecipients());
}

Expand All @@ -65,7 +67,7 @@ public function templateReplacements()
$talk = new TalkModel(["talk_title" => "sample talk"]);
$comment = ["comments" => [["comment" => "test comment", "rating" => 3]]];

$service = new \TalkCommentEmailService($this->config, $recipients, $talk, $comment);
$service = new TalkCommentEmailService($this->config, $recipients, $talk, $comment);
$service->templatePath = __DIR__.'/../../src/views/emails/';

$template = "testTemplate.md";
Expand Down Expand Up @@ -94,7 +96,7 @@ public function markdownTransform()
$talk = new TalkModel(["talk_title" => "sample talk"]);
$comment = ["comments" => [["comment" => "test comment", "rating" => 3]]];

$service = new \TalkCommentEmailService($this->config, $recipients, $talk, $comment);
$service = new TalkCommentEmailService($this->config, $recipients, $talk, $comment);

$html = $service->markdownToHtml($markdown);
$this->assertEquals(
Expand Down
4 changes: 3 additions & 1 deletion tests/models/ApiMapperTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

use PHPUnit\Framework\TestCase;

require_once __DIR__ . '/TestApiMapper.php';
/**
*
*/
class ApiMapperTest extends PHPUnit_Framework_TestCase
class ApiMapperTest extends TestCase
{
public function setup()
{
Expand Down
4 changes: 3 additions & 1 deletion tests/models/EventHostMapperTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

class EventHostMapperTest extends PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;

class EventHostMapperTest extends TestCase
{
public function testThatAddingHostToEventCallsExpectedInsert()
{
Expand Down
4 changes: 3 additions & 1 deletion tests/models/OauthModelTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

class OauthModelTest extends PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;

class OauthModelTest extends TestCase
{
public function setup()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/models/TalkMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
use PHPUnit_Framework_TestCase;
use Request;
use TalkMapper;
use PHPUnit\Framework\TestCase;

class TalkMapperTest extends PHPUnit_Framework_TestCase
class TalkMapperTest extends TestCase
{
public function testMediaTypesAreAddedCorrectly()
{
Expand Down
4 changes: 3 additions & 1 deletion tests/routers/ApiRouterTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php

use PHPUnit\Framework\TestCase;

require_once __DIR__ . '/../../src/inc/Request.php';

/**
* A class to test ApiRouter
*
* @covers ApiRouter
*/
class ApiRouterTest extends PHPUnit_Framework_TestCase
class ApiRouterTest extends TestCase
{

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/routers/DefaultRouterTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php

use PHPUnit\Framework\TestCase;

require_once __DIR__ . '/../../src/inc/Request.php';

/**
* A class to test DefaultRouter
*
* @covers DefaultRouter
*/
class DefaultRouterTest extends PHPUnit_Framework_TestCase
class DefaultRouterTest extends TestCase
{

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/routers/RouteTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php

use PHPUnit\Framework\TestCase;

/**
* Class to test Route
*
* @covers Route
*/
class RouteTest extends PHPUnit_Framework_TestCase
class RouteTest extends TestCase
{

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/routers/RouterTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php

use PHPUnit\Framework\TestCase;

require_once __DIR__ . '/../../src/inc/Request.php';

/**
* A class to test DefaultRouter
*
* @covers BaseRouter
*/
class RouterTest extends PHPUnit_Framework_TestCase
class RouterTest extends TestCase
{

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/routers/VersionedRouterTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php

use PHPUnit\Framework\TestCase;

require_once __DIR__ . '/../../src/inc/Request.php';

/**
* A class to test VersionedRouter
*
* @covers VersionedRouter
*/
class VersionedRouterTest extends PHPUnit_Framework_TestCase
class VersionedRouterTest extends TestCase
{

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/views/ApiViewTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

use PHPUnit\Framework\TestCase;

/**
* @covers ApiView
*/
class ApiViewTest extends PHPUnit_Framework_TestCase
class ApiViewTest extends TestCase
{
/**
* @runInSeparateProcess
Expand Down
4 changes: 3 additions & 1 deletion tests/views/JsonViewTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

use PHPUnit\Framework\TestCase;

/**
* @covers JsonView
*/
class JsonViewTest extends PHPUnit_Framework_TestCase
class JsonViewTest extends TestCase
{

/**
Expand Down

0 comments on commit 0f70ae5

Please sign in to comment.