Add some rudimentary tests

This commit is contained in:
Adam Backstrom 2013-07-25 13:25:26 -04:00
parent d2234c0ad8
commit 4683025210
5 changed files with 39 additions and 0 deletions

2
Makefile Normal file
View File

@ -0,0 +1,2 @@
test:
phpunit --bootstrap tests/bootstrap.php tests

14
tests/ActionDateCTest.php Normal file
View File

@ -0,0 +1,14 @@
<?php
class ActionDateCTest extends PHPUnit_Framework_TestCase {
function testDecode() {
$action = new ActionDateC("1374772515");
$expected = [1374772515 => '2013-07-25T17:15:15+00:00'];
$this->assertEquals($expected, $action->decode());
}
function testDecodeHasCorrectNumberOfResults() {
$action = new ActionDateC("1374772515\n1374772516");
$this->assertCount(2, $action->decode());
}
}

View File

@ -0,0 +1,8 @@
<?php
class ActionQuotedPrintableDecodeTest extends PHPUnit_Framework_TestCase {
function testDecode() {
$action = new ActionQuotedPrintableDecode('a=3Db');
$this->assertEquals('a=b', $action->decode());
}
}

View File

@ -0,0 +1,8 @@
<?php
class ActionQuotedPrintableEncodeTest extends PHPUnit_Framework_TestCase {
function testDecode() {
$action = new ActionQuotedPrintableEncode('a=b');
$this->assertEquals('a=3Db', $action->decode());
}
}

7
tests/bootstrap.php Normal file
View File

@ -0,0 +1,7 @@
<?php
date_default_timezone_set('UTC');
require_once 'dBug.php';
require_once 'classes.php';
require_once 'functions.php';