Browse Source

Add some rudimentary tests

master
Adam Backstrom 8 years ago
parent
commit
4683025210
  1. 2
      Makefile
  2. 14
      tests/ActionDateCTest.php
  3. 8
      tests/ActionQuotedPrintableDecodeTest.php
  4. 8
      tests/ActionQuotedPrintableEncodeTest.php
  5. 7
      tests/bootstrap.php

2
Makefile

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

14
tests/ActionDateCTest.php

@ -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());
}
}

8
tests/ActionQuotedPrintableDecodeTest.php

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

8
tests/ActionQuotedPrintableEncodeTest.php

@ -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

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