forked from FreePBX/superfecta
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
<?php | ||
/** | ||
* https://blogs.kent.ac.uk/webdev/2011/07/14/phpunit-and-unserialized-pdo-instances/ | ||
* @backupGlobals disabled | ||
* @backupStaticAttributes disabled | ||
*/ | ||
global $amp_conf, $db; | ||
if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { | ||
include_once('/etc/asterisk/freepbx.conf'); | ||
} | ||
restore_error_handler(); | ||
error_reporting(-1); | ||
error_reporting(E_ALL & ~(E_STRICT | E_NOTICE)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
/** | ||
* https://blogs.kent.ac.uk/webdev/2011/07/14/phpunit-and-unserialized-pdo-instances/ | ||
* @backupGlobals disabled | ||
*/ | ||
|
||
class Who_CalledTest extends PHPUnit_Framework_TestCase{ | ||
protected static $o; | ||
public static function setUpBeforeClass() { | ||
include 'setuptests.php'; | ||
$webroot = FreePBX::Config()->get('AMPWEBROOT'); | ||
include $webroot.'/admin/modules/superfecta/includes/superfecta_base.php'; | ||
include $webroot.'/admin/modules/superfecta/sources/source-Who_Called.module'; | ||
self::$o = new Who_Called(); | ||
} | ||
//Stuff before the test | ||
public function setup() {} | ||
//Leave this alone, it test that PHPUnit is working | ||
public function testPHPUnit() { | ||
$this->assertEquals("test", "test", "PHPUnit is broken."); | ||
$this->assertNotEquals("test", "nottest", "PHPUnit is broken."); | ||
} | ||
|
||
//This tests that the the object for your class is an object | ||
public function testCreate() {; | ||
$this->assertTrue(is_object(self::$o), "Did not get an object"); | ||
} | ||
|
||
public function testCnam(){ | ||
$cnam = self::$o->get_caller_id('6305424316',array('CNAM_Lookup' => true)); | ||
$this->assertEquals("Schaumburg%2C+IL", $cnam, "The lookup returned an unexpected result for 6305434316"); | ||
} | ||
} |