Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
More unit testing (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
edsonmedina committed Feb 8, 2015
1 parent 359adf1 commit 5777d03
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/AbstractIssue.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace edsonmedina\php_testability;

use edsonmedina\php_testability\NodeWrapper;
use PhpParser;

abstract class AbstractIssue implements IssueInterface
Expand Down
42 changes: 42 additions & 0 deletions tests/AbstractIssueTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

require_once __DIR__.'/../vendor/autoload.php';
use edsonmedina\php_testability\AbstractIssue;
use PhpParser\Node\Expr\Exit_;

class AbstractIssueTest extends PHPUnit_Framework_TestCase
{
/**
* @covers edsonmedina\php_testability\AbstractIssue::__construct
*/
public function testConstructor ()
{
$node = $this->getMockBuilder('PhpParser\Node\Expr\StaticCall')
->disableOriginalConstructor()
->getMock();

$issue = $this->getMockBuilder('edsonmedina\php_testability\AbstractIssue')
->setConstructorArgs(array($node))
->getMockForAbstractClass();

$this->assertAttributeEquals($node, 'node', $issue);
}

/**
* @covers edsonmedina\php_testability\AbstractIssue::getLine
*/
public function testGetLine ()
{
$node = $this->getMockBuilder('PhpParser\Node\Expr\StaticCall')
->disableOriginalConstructor()
->getMock();

$node->method('getLine')->willReturn (123);

$issue = $this->getMockBuilder('edsonmedina\php_testability\AbstractIssue')
->setConstructorArgs(array($node))
->getMockForAbstractClass();

$this->assertEquals (123, $issue->getLine());
}
}

0 comments on commit 5777d03

Please sign in to comment.