Add new sources
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 24 Sep 2013 19:38:34 +0000 (15:38 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 24 Sep 2013 19:38:34 +0000 (15:38 -0400)
Grabing these test files from my virtual machine.
Hopefully I'll be able to get them to work on my PHP 5.4 machine.

Toolkit/Members/Billing/Toolkit_Members_Billing_BillingTest.php [new file with mode: 0644]
Toolkit/Members/Billing/Toolkit_Members_Billing_FactoryTest.php [new file with mode: 0644]
Toolkit/Members/Billing/Toolkit_Members_Billing_InvoicesTest.php [new file with mode: 0644]
Toolkit/Members/Billing/Toolkit_Members_Billing_MemberAccountTest.php [new file with mode: 0644]
Toolkit/Members/Billing/Toolkit_Members_Billing_MemberListsTest.php [new file with mode: 0644]
Toolkit/Members/Billing/Toolkit_Members_Billing_PaymentTypesTest.php [new file with mode: 0644]
Toolkit/Members/Billing/Toolkit_Members_Billing_StatementTest.php [new file with mode: 0644]
Toolkit/Members/files/memberdb.sql [new file with mode: 0644]
Toolkit/Members/files/members-seed.xml [new file with mode: 0644]
bootstrap.php [new file with mode: 0644]
configuration.xml [new file with mode: 0644]

diff --git a/Toolkit/Members/Billing/Toolkit_Members_Billing_BillingTest.php b/Toolkit/Members/Billing/Toolkit_Members_Billing_BillingTest.php
new file mode 100644 (file)
index 0000000..dfede00
--- /dev/null
@@ -0,0 +1,254 @@
+<?php
+
+/**
+ * Test class for Toolkit_Members_Billing_Billing.
+ * Generated by PHPUnit on 2011-02-25 at 08:54:01.
+ */
+class Toolkit_Members_Billing_BillingTest extends PHPUnit_Framework_TestCase {
+
+    /**
+     * @var Toolkit_Members_Billing_Billing
+     */
+    protected $object;
+    protected $backupGlobals = false;
+    /**
+     * Global PDO object
+     * @var    object
+     * @access public
+     */
+       public $pdo;
+    /**
+     * Sets up the fixture, for example, opens a network connection.
+     * This method is called before a test is executed.
+     */
+    protected function setUp() {
+        $_GET = $_POST = array();
+               $dsn = 'sqlite::memory:';
+               $driverOptions = array(
+                       PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
+               );
+
+               $this->pdo = new PDO($dsn, null, null, $driverOptions);
+               $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+        $file = TEST_PATH . 'Toolkit/Members/files/memberdb.sql';
+               Toolkit_Common::createTables($this->pdo, $file);
+        
+        $this->object = new Toolkit_Members_Billing_Billing;
+    }
+
+    protected function getDatabaseTester()
+       {
+        $connection = new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($this->pdo, 'demo');
+        $tester     = new PHPUnit_Extensions_Database_DefaultTester($connection);
+
+        $tester->setSetUpOperation(PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT());
+        $tester->setTearDownOperation(PHPUnit_Extensions_Database_Operation_Factory::NONE());
+               $data = new PHPUnit_Extensions_Database_DataSet_FlatXmlDataSet(
+                       TEST_PATH . 'Toolkit/Members/files/members-seed.xml');
+               $tester->setDataSet($data);
+
+               return $tester;
+       }
+
+    protected function getDataSet($file)
+       {
+               return new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet($file);
+       }
+
+    /**
+     * Tears down the fixture, for example, closes a network connection.
+     * This method is called after a test is executed.
+     */
+    protected function tearDown() {
+
+    }
+
+    /**
+     * @todo Implement testSetBilling_type().
+     */
+    public function testSetBilling_type() {
+        $ret = $this->object->setBilling_type(1);
+        $this->assertInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+    }
+
+    /**
+     * @todo Implement testSetPaid().
+     */
+    public function testSetPaid() {
+        $ret = $this->object->setPaid(true);
+        $this->assertInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+    }
+
+    /**
+     * @todo Implement testSetPayment_method().
+     */
+    public function testSetPayment_method() {
+        $ret = $this->object->setPayment_method(1);
+        $this->assertInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+    }
+
+    /**
+     * @todo Implement testSetPayment_method().
+     */
+    public function testSetPayment_method_empty() {
+        $ret = $this->object->setPayment_method(null);
+        $this->assertInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+    }
+
+    public function testSetAmount() {
+        $ret = $this->object->setAmount(null);
+        $this->assertInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+        $ret = $this->object->setAmount(12);
+        $this->assertInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+    }
+
+    public function testGetAmountReturnsFloat()
+    {
+        $ret = $this->object->getAmount();
+        $this->assertInternalType('float', $ret);
+    }
+
+    public function testGetBalanceReturnsFloat()
+    {
+        $ret = $this->object->getBalance();
+        $this->assertInternalType('float', $ret);
+    }
+
+    /**
+     * @expectedException InvalidArgumentException
+     */
+    public function testSetBadAmount() {
+        $ret = $this->object->setAmount('hhh');
+    }
+
+    public function testSetBalance() {
+        $ret = $this->object->setBalance(null);
+        $this->assertInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+        $ret = $this->object->setBalance(12);
+        $this->assertInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+    }
+
+    /**
+     * @expectedException InvalidArgumentException
+     */
+    public function testSetBadBalance() {
+        $ret = $this->object->setBalance('hhh');
+    }
+
+    /**
+     * @todo Implement testSetMember_id().
+     */
+    public function testSetMember_id() {
+        $ret = $this->object->setMember_id(null);
+        $this->assertInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+        $ret = $this->object->setMember_id(12);
+        $this->assertInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+    }
+    
+    /**
+     * @expectedException InvalidArgumentException
+     */
+    public function testSetBadMember_id() {
+        $ret = $this->object->setMember_id('hhh');
+    }
+
+    /**
+     * @todo Implement testSetEmailed().
+     */
+    public function testSetEmailed() {
+        $ret = $this->object->setEmailed(true);
+        $this->assertInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+    }
+
+    /**
+     * @todo Implement testSetPrinted().
+     */
+    public function testSetPrinted() {
+        $ret = $this->object->setPrinted(true);
+        $this->assertInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+    }
+
+    /**
+     * @expectedException InvalidArgumentException
+     */
+    public function testExceptionFromBadSetBillingType()
+    {
+        $ret = $this->object->setBilling_type(null);
+        $ret = $this->object->setBilling_type(9);
+    }
+
+    /**
+     * @expectedException InvalidArgumentException
+     */
+    public function testExceptionFromBadSetBillingTypeNumber()
+    {
+        $ret = $this->object->setBilling_type(9);
+    }
+
+    /**
+     * @expectedException InvalidArgumentException
+     */
+    public function testExceptionFromBadSetPaymentMethod()
+    {
+        $ret = $this->object->setPayment_method('nen');
+    }
+
+    public function testInsertBilling()
+    {
+        $tester = $this->getDatabaseTester();
+               $tester->onSetUp();
+        
+        $stub = $this->getMock(
+            'Toolkit_Members_Billing_Billing',
+            array('insert')
+        );
+        $stub->expects($this->once())
+            ->method('insert');
+        $stub->insert($this->pdo);
+        
+//        $ret = Toolkit_Members_Billing_Factory::createDbObjectByValues(
+//            'Toolkit_Members_Billing_Billing',
+//            array(
+//                'invoice_id'       => 1,
+//                'transaction_time' => '2011-02-02',
+//                'transaction_date' => '2011-02-02',
+//                'member_name'      => 'Gaslight Media',
+//                'member_id'        => '1',
+//                'account_number'   => '8974789342',
+//                'billing_type'     => 1,
+//                'amount'           => '350.00',
+//                'payment_method'   => 1,
+//                'payment_data'     => '#47646',
+//                'paid'             => 't',
+//                'notes'            => '',
+//                'invoices'         => '',
+//            )
+//        );
+//        $this->assertInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+//        $ret->save($this->pdo);
+        
+        $tester->onTearDown();
+    }
+
+    public function testUpdateBilling()
+    {
+        $tester = $this->getDatabaseTester();
+               $tester->onSetUp();
+        
+//        $ret = Toolkit_Members_Billing_Factory::createDbObjectById(
+//            $this->pdo,
+//            'Toolkit_Members_Billing_Billing',
+//            1
+//        );
+//        $this->assertInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+//        $ret->save($this->pdo);
+        
+        $stub = $this->getMock('Toolkit_Members_Billing_Billing');
+        $stub->update($this->pdo);
+        
+        $tester->onTearDown();
+    }
+}
+
+?>
diff --git a/Toolkit/Members/Billing/Toolkit_Members_Billing_FactoryTest.php b/Toolkit/Members/Billing/Toolkit_Members_Billing_FactoryTest.php
new file mode 100644 (file)
index 0000000..7bbb7c8
--- /dev/null
@@ -0,0 +1,192 @@
+<?php
+
+/**
+ * Test class for Toolkit_Members_Billing_Factory.
+ * Generated by PHPUnit on 2011-02-25 at 09:08:52.
+ */
+class Toolkit_Members_Billing_FactoryTest extends PHPUnit_Framework_TestCase {
+
+    /**
+     * @var Toolkit_Members_Billing_Factory
+     */
+    protected $object;
+    protected $backupGlobals = false;
+    /**
+     * Global PDO object
+     * @var    object
+     * @access public
+     */
+       public $pdo;
+    /**
+     * Sets up the fixture, for example, opens a network connection.
+     * This method is called before a test is executed.
+     */
+    protected function setUp() {
+        $_GET = $_POST = array();
+               $dsn = 'sqlite::memory:';
+               $driverOptions = array(
+                       PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
+               );
+
+               $this->pdo = new PDO($dsn, null, null, $driverOptions);
+               $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+        $file = TEST_PATH . 'Toolkit/Members/files/memberdb.sql';
+               Toolkit_Common::createTables($this->pdo, $file);
+        
+        $this->object = new Toolkit_Members_Billing_Factory;
+    }
+
+    protected function getDatabaseTester()
+       {
+        $connection = new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($this->pdo, 'demo');
+        $tester     = new PHPUnit_Extensions_Database_DefaultTester($connection);
+
+        $tester->setSetUpOperation(PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT());
+        $tester->setTearDownOperation(PHPUnit_Extensions_Database_Operation_Factory::NONE());
+               $data = new PHPUnit_Extensions_Database_DataSet_FlatXmlDataSet(
+                       TEST_PATH . 'Toolkit/Members/files/members-seed.xml');
+               $tester->setDataSet($data);
+
+               return $tester;
+       }
+
+    protected function getDataSet($file)
+       {
+               return new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet($file);
+       }
+
+    /**
+     * Tears down the fixture, for example, closes a network connection.
+     * This method is called after a test is executed.
+     */
+    protected function tearDown() {
+
+    }
+
+    public function testCreateBillingObjectById()
+    {
+        $tester = $this->getDatabaseTester();
+               $tester->onSetUp();
+        
+        $ret = $this->object->createDbObjectById(
+            $this->pdo,
+            'Toolkit_Members_Billing_Billing',
+            1
+        );
+        $this->assertInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+        
+        $tester->onTearDown();
+    }
+    public function testCreateMemberAccountObjectById()
+    {
+        $tester = $this->getDatabaseTester();
+               $tester->onSetUp();
+        
+        $ret = $this->object->createDbObjectById(
+            $this->pdo,
+            'Toolkit_Members_Billing_MemberAccount',
+            1
+        );
+        $this->assertInstanceOf('Toolkit_Members_Billing_MemberAccount', $ret);
+        
+        $tester->onTearDown();
+    }
+    public function testCreatePaymentTypesObjectById()
+    {
+        $ret = $this->object->createDbObjectById(
+            $this->pdo,
+            'Toolkit_Members_Billing_PaymentTypes',
+            1
+        );
+        $this->assertInstanceOf('Toolkit_Members_Billing_PaymentTypes', $ret);
+    }
+
+    public function testCreateBillingObjectByValues()
+    {
+        $ret = $this->object->createDbObjectByValues(
+            'Toolkit_Members_Billing_Billing',
+            array(
+                'invoice_id'       => 1,
+                'transaction_time' => '2011-02-02',
+                'transaction_date' => '2011-02-02',
+                'member_name'      => 'Gaslight Media',
+                'member_id'        => '1',
+                'account_number'   => '8974789342',
+                'billing_type'     => 1,
+                'amount'           => '350.00',
+                'payment_method'   => 1,
+                'payment_data'     => '#47646',
+                'paid'             => 't',
+                'notes'            => '',
+                'invoices'         => '',
+            )
+        );
+        $this->assertInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+    }
+
+    public function testCreatePaymentTypesObjectByValues()
+    {
+        $ret = $this->object->createDbObjectByValues(
+            'Toolkit_Members_Billing_PaymentTypes',
+            array(
+                'name'     => 'Basic Member',
+                'category' => 'test category',
+                'qcode'    => 4545,
+                'amount'   => '350.00',
+                'notes'    => ''
+            )
+        );
+        $this->assertInstanceOf('Toolkit_Members_Billing_PaymentTypes', $ret);
+    }
+
+    public function testCreateMemberAccountObjectByValues()
+    {
+        $ret = $this->object->createDBObjectByValues(
+            'Toolkit_Members_Billing_MemberAccount',
+            array(
+                'member_id'      => 1,
+                'payment_type'   => 1,
+                'email_invoice'  => 1,
+                'usmail_invoice' => 1,
+                'fax_invoice'    => 1
+            )
+        );
+    }
+
+    public function testNothingFromBillingWhenNoClassGiven()
+    {
+        $ret = $this->object->createDBObjectByValues('', array());
+        $this->assertNotInstanceOf('Toolkit_Members_Billing_Billing', $ret);
+    }
+
+    public function testNothingFromPaymentTypesWhenNoClassGiven()
+    {
+        $ret = $this->object->createDBObjectById($this->pdo, '', 1);
+        $this->assertNotInstanceOf('Toolkit_Members_Billing_PaymentTypes', $ret);
+    }
+    /**
+     * @expectedException InvalidArgumentException
+     */
+    public function testBadCallById()
+    {
+        $ret = $this->object->createDbObjectById(
+            $this->pdo,
+            'Toolkit_Members_Billing_PaymentTypes',
+            'favorite'
+        );
+    }
+
+    /**
+     * @expectedException InvalidArgumentException
+     */
+    public function testBadCallByValues()
+    {
+        $ret = $this->object->createDBObjectByValues(
+            'Toolkit_Members_Billing_PaymentTypes',
+            null
+        );
+    }
+}
+
+?>
diff --git a/Toolkit/Members/Billing/Toolkit_Members_Billing_InvoicesTest.php b/Toolkit/Members/Billing/Toolkit_Members_Billing_InvoicesTest.php
new file mode 100644 (file)
index 0000000..448fab8
--- /dev/null
@@ -0,0 +1,185 @@
+<?php
+
+/**
+ * Test class for Toolkit_Members_Billing_Invoices.
+ * Generated by PHPUnit on 2011-02-24 at 10:19:22.
+ */
+class Toolkit_Members_Billing_InvoicesTest extends PHPUnit_Framework_TestCase {
+
+    /**
+     * @var Toolkit_Members_Billing_Invoices
+     */
+    protected $object;
+    protected $backupGlobals = false;
+    /**
+     * Global PDO object
+     * @var    object
+     * @access public
+     */
+       public $pdo;
+
+    /**
+     * Sets up the fixture, for example, opens a network connection.
+     * This method is called before a test is executed.
+     */
+    protected function setUp() {
+        
+        $_GET = $_POST = array();
+               $dsn = 'sqlite::memory:';
+               $driverOptions = array(
+                       PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
+               );
+
+               $this->pdo = new PDO($dsn, null, null, $driverOptions);
+               $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+        $file = TEST_PATH . 'Toolkit/Members/files/memberdb.sql';
+               Toolkit_Common::createTables($this->pdo, $file);
+        
+        $this->object = new Toolkit_Members_Billing_Invoices();
+        
+    }
+
+    protected function getDatabaseTester()
+       {
+        $connection = new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($this->pdo, 'demo');
+        $tester     = new PHPUnit_Extensions_Database_DefaultTester($connection);
+
+        $tester->setSetUpOperation(PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT());
+        $tester->setTearDownOperation(PHPUnit_Extensions_Database_Operation_Factory::NONE());
+               $data = new PHPUnit_Extensions_Database_DataSet_FlatXmlDataSet(
+                       TEST_PATH . 'Toolkit/Members/files/members-seed.xml');
+               $tester->setDataSet($data);
+
+               return $tester;
+       }
+
+    protected function getDataSet($file)
+       {
+               return new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet($file);
+       }
+    
+    /**
+     * Tears down the fixture, for example, closes a network connection.
+     * This method is called after a test is executed.
+     */
+    protected function tearDown() {
+
+    }
+
+    /**
+     * @todo Implement testCreateInvoices().
+     */
+    public function testCreateInvoices() {
+        $tester = $this->getDatabaseTester();
+               $tester->onSetUp();
+
+        $members = $this->object->createInvoices($this->pdo);
+
+        $tester->onTearDown();
+    }
+
+    /**
+     * @todo Implement testGetCurrentInvoiceDate().
+     */
+    public function testGetCurrentInvoiceDate() {
+        $day   = 1;
+        $month = 7;
+        $year  = date('Y');
+        $time  = mktime(
+            0,
+            0,
+            0,
+            $month,
+            $day,
+            $year
+        );
+        $invoiceDate = date('U', $time);
+        $return = $this->object->getCurrentInvoiceDate(true);
+        $this->assertEquals($invoiceDate, $return, 'Not equal');
+    }
+
+    /**
+     * @todo Implement testGetNextInvoiceDate().
+     */
+    public function testGetNextInvoiceDate() {
+        $day   = 1;
+        $month = 7;
+        $year
+            = (date('n') >= 7)
+            ? date('Y') + 1
+            : date('Y');
+        $time  = mktime(
+            0,
+            0,
+            0,
+            $month,
+            $day,
+            $year
+        );
+        $invoiceDate = date('U', $time);
+        $return = $this->object->getNextInvoiceDate();
+        $this->assertEquals($invoiceDate, $return, 'Not equal');
+    }
+
+    /**
+     * @todo Implement testHasInvoice().
+     */
+    public function testHasInvoice() {
+        $tester = $this->getDatabaseTester();
+               $tester->onSetUp();
+
+        $member = array(
+            'member_id' => 1,
+            'account_id' => 1
+        );
+        $hasInvoice = ($this->object->hasInvoice($this->pdo, $member));
+        $this->assertTrue($hasInvoice);
+        
+        $tester->onTearDown();
+    }
+
+    public function testGetMemberDataFromId()
+    {
+        $tester = $this->getDatabaseTester();
+               $tester->onSetUp();
+
+        $ret = $this->object->getMemberData($this->pdo, 1);
+        $this->assertEquals('AAA Test Business 1', $ret['member_name']);
+
+        $tester->onTearDown();
+    }
+
+    public function testAddInvoice()
+    {
+        $tester = $this->getDatabaseTester();
+        $tester->onSetup();
+
+        $member = array(
+            'member_id'    => 2,
+            'payment_type' => 1
+        );
+        
+        $mockObject = $this->getMock(
+            'Toolkit_Members_Billing_Invoices'
+        );
+        $mockObject->expects($this->any())
+            ->method('hasInvoice')
+            ->will($this->returnValue(false));
+
+        $members = $mockObject->addInvoice($this->pdo, $member);
+
+        $tester->onTearDown();
+    }
+
+    /**
+     * @expected PDOException
+     */
+    public function testGetMemberDataBadPDO()
+    {
+        $this->object->getMemberData($this->pdo, 'help');
+    }
+
+}
+
+?>
diff --git a/Toolkit/Members/Billing/Toolkit_Members_Billing_MemberAccountTest.php b/Toolkit/Members/Billing/Toolkit_Members_Billing_MemberAccountTest.php
new file mode 100644 (file)
index 0000000..922316a
--- /dev/null
@@ -0,0 +1,134 @@
+<?php
+
+/**
+ * Test class for Toolkit_Members_Billing_MemberAccount.
+ * Generated by PHPUnit on 2011-04-06 at 14:58:21.
+ */
+class Toolkit_Members_Billing_MemberAccountTest extends PHPUnit_Framework_TestCase {
+
+    /**
+     * @var Toolkit_Members_Billing_MemberAccount
+     */
+    protected $object;
+    protected $backupGlobals = false;
+    /**
+     * Global PDO object
+     * @var    object
+     * @access public
+     */
+       public $pdo;
+
+    /**
+     * Sets up the fixture, for example, opens a network connection.
+     * This method is called before a test is executed.
+     */
+    protected function setUp() {
+        $_GET = $_POST = array();
+               $dsn = 'sqlite::memory:';
+               $driverOptions = array(
+                       PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
+               );
+
+               $this->pdo = new PDO($dsn, null, null, $driverOptions);
+               $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+        $file = TEST_PATH . 'Toolkit/Members/files/memberdb.sql';
+               Toolkit_Common::createTables($this->pdo, $file);
+        
+        $this->object = new Toolkit_Members_Billing_MemberAccount();
+    }
+    protected function getDatabaseTester()
+       {
+        $connection = new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($this->pdo, 'demo');
+        $tester     = new PHPUnit_Extensions_Database_DefaultTester($connection);
+
+        $tester->setSetUpOperation(PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT());
+        $tester->setTearDownOperation(PHPUnit_Extensions_Database_Operation_Factory::NONE());
+               $data = new PHPUnit_Extensions_Database_DataSet_FlatXmlDataSet(
+                       TEST_PATH . 'Toolkit/Members/files/members-seed.xml');
+               $tester->setDataSet($data);
+
+               return $tester;
+       }
+
+    protected function getDataSet($file)
+       {
+               return new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet($file);
+       }
+    /**
+     * Tears down the fixture, for example, closes a network connection.
+     * This method is called after a test is executed.
+     */
+    protected function tearDown() {
+        
+    }
+
+    /**
+     * @todo Implement testSetEmail_invoice().
+     */
+    public function testSetEmail_invoice() {
+        $ret = $this->object->setEmail_invoice(true);
+        $this->assertInstanceOf('Toolkit_Members_Billing_MemberAccount', $ret);
+    }
+
+    /**
+     * @todo Implement testSetUsmail_invoice().
+     */
+    public function testSetUsmail_invoice() {
+        $ret = $this->object->setUsmail_invoice(true);
+        $this->assertInstanceOf('Toolkit_Members_Billing_MemberAccount', $ret);
+    }
+
+    /**
+     * @todo Implement testSetFax_invoice().
+     */
+    public function testSetFax_invoice() {
+        $ret = $this->object->setFax_invoice(true);
+        $this->assertInstanceOf('Toolkit_Members_Billing_MemberAccount', $ret);
+    }
+
+    /**
+     * @todo Implement testSetPayment_type().
+     */
+    public function testSetPayment_type() {
+        $ret = $this->object->setPayment_type(1);
+        $this->assertInstanceOf('Toolkit_Members_Billing_MemberAccount', $ret);
+    }
+
+    /**
+     * @todo Implement testSetMember_id().
+     */
+    public function testSetMember_id() {
+        $ret = $this->object->setMember_id(1);
+        $this->assertInstanceOf('Toolkit_Members_Billing_MemberAccount', $ret);
+    }
+    
+    /**
+     * @expectedException InvalidArgumentException
+     */
+    public function testSetMemberIdBadThrowsException()
+    {
+        $member_id = 'five';
+        $this->object->setMember_id($member_id);
+    }
+    
+    /**
+     * @expectedException InvalidArgumentException
+     */
+    public function testSetPaymentTypeBadThrowsException()
+    {
+        $payment_type = 'five';
+        $this->object->setPayment_type($payment_type);
+    }
+    
+    /**
+     * @expectedException Exception
+     */
+    public function testBadAttributeThrowsException()
+    {
+        $this->object->setNo_attribute_found(true);
+    }
+
+}
+
+?>
diff --git a/Toolkit/Members/Billing/Toolkit_Members_Billing_MemberListsTest.php b/Toolkit/Members/Billing/Toolkit_Members_Billing_MemberListsTest.php
new file mode 100644 (file)
index 0000000..37c5994
--- /dev/null
@@ -0,0 +1,130 @@
+<?php
+
+/**
+ * Test class for Toolkit_Members_Billing_MemberLists.
+ * Generated by PHPUnit on 2011-05-17 at 13:28:30.
+ */
+class Toolkit_Members_Billing_MemberListsTest
+    extends PHPUnit_Framework_TestCase
+{
+
+    /**
+     * @var Toolkit_Members_Billing_MemberLists
+     */
+    protected $object;
+    protected $backupGlobals = false;
+    /**
+     * Global PDO object
+     * @var    object
+     * @access public
+     */
+       public $pdo;
+
+    /**
+     * Sets up the fixture, for example, opens a network connection.
+     * This method is called before a test is executed.
+     */
+    protected function setUp()
+    {
+        $_GET = $_POST = array();
+               $dsn = 'sqlite::memory:';
+               $driverOptions = array(
+                       PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
+               );
+
+               $this->pdo = new PDO($dsn, null, null, $driverOptions);
+               $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+        $file = TEST_PATH . 'Toolkit/Members/files/memberdb.sql';
+               Toolkit_Common::createTables($this->pdo, $file);
+        
+        $this->object = new Toolkit_Members_Billing_MemberLists($this->pdo);
+    }
+    
+    protected function getDatabaseTester()
+       {
+        $connection = new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($this->pdo, 'demo');
+        $tester     = new PHPUnit_Extensions_Database_DefaultTester($connection);
+
+        $tester->setSetUpOperation(PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT());
+        $tester->setTearDownOperation(PHPUnit_Extensions_Database_Operation_Factory::NONE());
+               $data = new PHPUnit_Extensions_Database_DataSet_FlatXmlDataSet(
+                       TEST_PATH . 'Toolkit/Members/files/members-seed.xml');
+               $tester->setDataSet($data);
+
+               return $tester;
+       }
+
+    protected function getDataSet($file)
+       {
+               return new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet($file);
+       }
+
+    /**
+     * Tears down the fixture, for example, closes a network connection.
+     * This method is called after a test is executed.
+     */
+    protected function tearDown()
+    {
+        
+    }
+
+    /**
+     * @todo Implement testGetOpenAccounts().
+     */
+    public function testGetOpenAccounts()
+    {
+        $ret = $this->object->getOpenAccounts();
+    }
+
+    /**
+     * @todo Implement testGetAccountsByAge().
+     */
+    public function testGetAccountsByAge()
+    {
+        $ret = $this->object->getAccountsByAge();
+    }
+
+    /**
+     * @todo Implement testGetClosedAccounts().
+     */
+    public function testGetClosedAccounts()
+    {
+        $ret = $this->object->getClosedAccounts();
+    }
+
+    /**
+     * @todo Implement testGetPrintableInvoices().
+     */
+    public function testGetPrintableInvoices()
+    {
+        $ret = $this->object->getPrintableInvoices();
+    }
+
+    /**
+     * @todo Implement testGetEmailableInvoices().
+     */
+    public function testGetEmailableInvoices()
+    {
+        $ret = $this->object->getEmailableInvoices();
+    }
+
+    /**
+     * @todo Implement testGetMailableInvoices().
+     */
+    public function testGetMailableInvoices()
+    {
+        $ret = $this->object->getMailableInvoices();
+    }
+
+    /**
+     * @todo Implement testGetNeededInvoices().
+     */
+    public function testGetNeededInvoices()
+    {
+        $ret = $this->object->getNeededInvoices();
+    }
+
+}
+
+?>
diff --git a/Toolkit/Members/Billing/Toolkit_Members_Billing_PaymentTypesTest.php b/Toolkit/Members/Billing/Toolkit_Members_Billing_PaymentTypesTest.php
new file mode 100644 (file)
index 0000000..ceeb483
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+
+/**
+ * Test class for Toolkit_Members_Billing_PaymentTypes.
+ * Generated by PHPUnit on 2011-02-25 at 10:52:43.
+ */
+class Toolkit_Members_Billing_PaymentTypesTest extends PHPUnit_Framework_TestCase {
+
+    /**
+     * @var Toolkit_Members_Billing_PaymentTypes
+     */
+    protected $object;
+    protected $backupGlobals = false;
+    /**
+     * Global PDO object
+     * @var    object
+     * @access public
+     */
+       public $pdo;
+
+    /**
+     * Sets up the fixture, for example, opens a network connection.
+     * This method is called before a test is executed.
+     */
+    protected function setUp() {
+        $_GET = $_POST = array();
+               $dsn = 'sqlite::memory:';
+               $driverOptions = array(
+                       PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
+               );
+
+               $this->pdo = new PDO($dsn, null, null, $driverOptions);
+               $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+        $file = TEST_PATH . 'Toolkit/Members/files/memberdb.sql';
+               Toolkit_Common::createTables($this->pdo, $file);
+        
+        $this->object = new Toolkit_Members_Billing_PaymentTypes;
+    }
+
+    /**
+     * Tears down the fixture, for example, closes a network connection.
+     * This method is called after a test is executed.
+     */
+    protected function tearDown() {
+        
+    }
+
+    public function testCreatesObject()
+    {
+        $this->assertInstanceOf('Toolkit_Members_Billing_PaymentTypes', $this->object);
+    }
+    
+    public function testSetQcode()
+    {
+        $ret = $this->object->setQcode(1);
+        $this->assertInstanceOf('Toolkit_Members_Billing_PaymentTypes', $ret);
+        $this->assertEquals(1, $ret->getQcode(), 'qcode given does not match what is is object');
+    }
+    
+    /**
+     * @throws InvalidArgumentException 
+     * @expectedException InvalidArgumentException
+     */
+    public function testSetQcodeWithInvalidParameter()
+    {
+        $ret = $this->object->setQcode('invalid number');
+    }
+}
+
+?>
diff --git a/Toolkit/Members/Billing/Toolkit_Members_Billing_StatementTest.php b/Toolkit/Members/Billing/Toolkit_Members_Billing_StatementTest.php
new file mode 100644 (file)
index 0000000..15c67ce
--- /dev/null
@@ -0,0 +1,146 @@
+<?php
+
+/**
+ * Test class for Toolkit_Members_Billing_Statement.
+ * Generated by PHPUnit on 2011-02-25 at 16:42:26.
+ */
+class Toolkit_Members_Billing_StatementTest extends PHPUnit_Framework_TestCase {
+
+    /**
+     * @var Toolkit_Members_Billing_Statement
+     */
+    protected $object;
+    protected $backupGlobals = false;
+    /**
+     * Global PDO object
+     * @var    object
+     * @access public
+     */
+       public $pdo;
+    /**
+     * Sets up the fixture, for example, opens a network connection.
+     * This method is called before a test is executed.
+     */
+    protected function setUp() {
+        $_GET = $_POST = array();
+               $dsn = 'sqlite::memory:';
+               $driverOptions = array(
+                       PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
+               );
+
+               $this->pdo = new PDO($dsn, null, null, $driverOptions);
+               $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+        $file = TEST_PATH . 'Toolkit/Members/files/memberdb.sql';
+               Toolkit_Common::createTables($this->pdo, $file);
+        
+        $this->object = new Toolkit_Members_Billing_Statement();
+    }
+
+    protected function getDatabaseTester()
+       {
+        $connection = new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($this->pdo, 'demo');
+        $tester     = new PHPUnit_Extensions_Database_DefaultTester($connection);
+
+        $tester->setSetUpOperation(PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT());
+        $tester->setTearDownOperation(PHPUnit_Extensions_Database_Operation_Factory::NONE());
+               $data = new PHPUnit_Extensions_Database_DataSet_FlatXmlDataSet(
+                       TEST_PATH . 'Toolkit/Members/files/members-seed.xml');
+               $tester->setDataSet($data);
+
+               return $tester;
+       }
+
+    protected function getDataSet($file)
+       {
+               return new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet($file);
+       }
+
+    /**
+     * Tears down the fixture, for example, closes a network connection.
+     * This method is called after a test is executed.
+     */
+    protected function tearDown() {
+
+    }
+
+    /**
+     * @todo Implement testGetBalanceDue().
+     */
+    public function testGetBalanceDue() {
+        $ret = $this->object->getBalanceDue(
+            $this->pdo,
+            1,
+            1
+        );
+        $this->assertEquals('0.00', $ret);
+    }
+    /**
+     * @expectedException InvalidArgumentException
+     */
+    public function testBadCallGetBalanceDueThrowsException()
+    {
+        $ret = $this->object->getBalanceDue(
+            $this->pdo,
+            'setme',
+            1
+        );
+        $this->assertEquals('0.00', $ret);
+    }
+    
+    public function testCreateMemberStatements()
+    {
+        $tester = $this->getDatabaseTester();
+               $tester->onSetUp();
+        
+        $_REQUEST['id'] = 1;
+        $ret = $this->object->createMemberStatements(
+            $this->pdo,
+            1
+        );
+        
+        $tester->onTearDown();
+    }
+    public function testCreateAllMemberStatements()
+    {
+        $tester = $this->getDatabaseTester();
+               $tester->onSetUp();
+        
+        $_REQUEST['id'] = 1;
+        $ret = $this->object->createMemberStatements(
+            $this->pdo,
+            1,
+            true
+        );
+        
+        $tester->onTearDown();
+    }
+    
+    /**
+     * @expectedException InvalidArgumentException
+     */
+    public function testSetMemberIdBadThrowsException()
+    {
+        $_REQUEST['id'] = 1;
+        $ret = $this->object->createMemberStatements(
+            $this->pdo,
+            'not a number',
+            true
+        );
+    }
+    
+    /**
+     * @expected PDOException
+     */
+    public function testGetMemberDataBadPDO()
+    {
+        $_REQUEST['id'] = 1;
+        $ret = $this->object->createMemberStatements(
+            $this->pdo,
+            1,
+            true
+        );
+    }
+}
+
+?>
diff --git a/Toolkit/Members/files/memberdb.sql b/Toolkit/Members/files/memberdb.sql
new file mode 100644 (file)
index 0000000..8c41599
--- /dev/null
@@ -0,0 +1,350 @@
+CREATE TABLE state (
+state_id       integer PRIMARY KEY,
+state_name     text,
+state_abb      varchar(2)
+);
+
+DELETE FROM state;
+INSERT INTO state (state_name, state_abb) VALUES ('Alabama', 'AL');
+INSERT INTO state (state_name, state_abb) VALUES ('Alaska', 'AK');
+INSERT INTO state (state_name, state_abb) VALUES ('Arizona', 'AZ');
+INSERT INTO state (state_name, state_abb) VALUES ('Arkansas', 'AR');
+INSERT INTO state (state_name, state_abb) VALUES ('California', 'CA');
+INSERT INTO state (state_name, state_abb) VALUES ('Colorado', 'CO');
+INSERT INTO state (state_name, state_abb) VALUES ('Connecticut', 'CT');
+INSERT INTO state (state_name, state_abb) VALUES ('Delaware', 'DE');
+INSERT INTO state (state_name, state_abb) VALUES ('District of Columbia', 'DC');
+INSERT INTO state (state_name, state_abb) VALUES ('Florida', 'FL');
+INSERT INTO state (state_name, state_abb) VALUES ('Georgia', 'GA');
+INSERT INTO state (state_name, state_abb) VALUES ('Hawaii', 'HI');
+INSERT INTO state (state_name, state_abb) VALUES ('Idaho', 'ID');
+INSERT INTO state (state_name, state_abb) VALUES ('Illinois', 'IL');
+INSERT INTO state (state_name, state_abb) VALUES ('Indiana', 'IN');
+INSERT INTO state (state_name, state_abb) VALUES ('Iowa', 'IA');
+INSERT INTO state (state_name, state_abb) VALUES ('Kansas', 'KS');
+INSERT INTO state (state_name, state_abb) VALUES ('Kentucky', 'KY');
+INSERT INTO state (state_name, state_abb) VALUES ('Louisiana', 'LA');
+INSERT INTO state (state_name, state_abb) VALUES ('Maine', 'ME');
+INSERT INTO state (state_name, state_abb) VALUES ('Maryland', 'MD');
+INSERT INTO state (state_name, state_abb) VALUES ('Massachusetts', 'MA');
+INSERT INTO state (state_name, state_abb) VALUES ('Michigan', 'MI');
+INSERT INTO state (state_name, state_abb) VALUES ('Minnesota', 'MN');
+INSERT INTO state (state_name, state_abb) VALUES ('Mississppi', 'MS');
+INSERT INTO state (state_name, state_abb) VALUES ('Missouri', 'MO');
+INSERT INTO state (state_name, state_abb) VALUES ('Montana', 'MT');
+INSERT INTO state (state_name, state_abb) VALUES ('Nebraska', 'NE');
+INSERT INTO state (state_name, state_abb) VALUES ('Nevada', 'NV');
+INSERT INTO state (state_name, state_abb) VALUES ('New Hampshire', 'NH');
+INSERT INTO state (state_name, state_abb) VALUES ('New Jersey', 'NJ');
+INSERT INTO state (state_name, state_abb) VALUES ('New Mexico', 'NM');
+INSERT INTO state (state_name, state_abb) VALUES ('New York', 'NY');
+INSERT INTO state (state_name, state_abb) VALUES ('North Carolina', 'NC');
+INSERT INTO state (state_name, state_abb) VALUES ('North Dakota', 'ND');
+INSERT INTO state (state_name, state_abb) VALUES ('Ohio', 'OH');
+INSERT INTO state (state_name, state_abb) VALUES ('Oklahoma', 'OK');
+INSERT INTO state (state_name, state_abb) VALUES ('Oregon', 'OR');
+INSERT INTO state (state_name, state_abb) VALUES ('Pennsylvania', 'PA');
+INSERT INTO state (state_name, state_abb) VALUES ('Rhode Island', 'RI');
+INSERT INTO state (state_name, state_abb) VALUES ('South Carolina', 'SC');
+INSERT INTO state (state_name, state_abb) VALUES ('South Dakota', 'SD');
+INSERT INTO state (state_name, state_abb) VALUES ('Tennessee', 'TN');
+INSERT INTO state (state_name, state_abb) VALUES ('Texas', 'TX');
+INSERT INTO state (state_name, state_abb) VALUES ('Utah', 'UT');
+INSERT INTO state (state_name, state_abb) VALUES ('Vermont', 'VT');
+INSERT INTO state (state_name, state_abb) VALUES ('Virginia', 'VA');
+INSERT INTO state (state_name, state_abb) VALUES ('Washington', 'WA');
+INSERT INTO state (state_name, state_abb) VALUES ('West Virginia', 'WV');
+INSERT INTO state (state_name, state_abb) VALUES ('Wisconsin', 'WI');
+INSERT INTO state (state_name, state_abb) VALUES ('Wyoming', 'WY');
+INSERT INTO state (state_name, state_abb) VALUES ('Alberta', 'AB');
+INSERT INTO state (state_name, state_abb) VALUES ('American Samoa', 'AS');
+INSERT INTO state (state_name, state_abb) VALUES ('British Columbia', 'BC');
+INSERT INTO state (state_name, state_abb) VALUES ('Federated States of Micronesia', 'FM');
+INSERT INTO state (state_name, state_abb) VALUES ('Guam', 'GU');
+INSERT INTO state (state_name, state_abb) VALUES ('Manitoba', 'MB');
+INSERT INTO state (state_name, state_abb) VALUES ('Marshall Islands', 'MH');
+INSERT INTO state (state_name, state_abb) VALUES ('New Brunswick', 'NB');
+INSERT INTO state (state_name, state_abb) VALUES ('Newfoundland', 'NF');
+INSERT INTO state (state_name, state_abb) VALUES ('Northern Mariana Islands', 'MP');
+INSERT INTO state (state_name, state_abb) VALUES ('Northwest Territories', 'NT');
+INSERT INTO state (state_name, state_abb) VALUES ('Nova Scotia', 'NS');
+INSERT INTO state (state_name, state_abb) VALUES ('Ontario', 'ON');
+INSERT INTO state (state_name, state_abb) VALUES ('Palau', 'PW');
+INSERT INTO state (state_name, state_abb) VALUES ('Prince Edward Island', 'PE');
+INSERT INTO state (state_name, state_abb) VALUES ('Puerto Rico', 'PR');
+INSERT INTO state (state_name, state_abb) VALUES ('Quebec', 'QC');
+INSERT INTO state (state_name, state_abb) VALUES ('Saskatchewan', 'SK');
+INSERT INTO state (state_name, state_abb) VALUES ('Virgin Islands', 'VI');
+INSERT INTO state (state_name, state_abb) VALUES ('Yukon', 'YT');
+
+CREATE TABLE region (
+region_id      integer PRIMARY KEY,
+region_name    text UNIQUE
+);
+
+INSERT INTO region (region_name) VALUES ('Temp Region');
+
+CREATE TABLE county (
+county_id      integer PRIMARY KEY,
+state_id       integer REFERENCES state(state_id) ON DELETE CASCADE,
+county_name    text,
+region_id      integer REFERENCES region(region_id) ON DELETE CASCADE
+);
+
+INSERT INTO county(state_id, county_name, region_id) VALUES (1, 'Temp County', 1);
+
+CREATE TABLE city (
+city_id                integer PRIMARY KEY,
+state_id       integer REFERENCES state(state_id) ON DELETE CASCADE,
+city_name      text,
+county_id      integer REFERENCES county(county_id) ON DELETE CASCADE,
+region_id      integer REFERENCES region(region_id) ON DELETE CASCADE,
+description    text,
+image          text,
+zip         text,
+lat                    double precision,
+lon                    double precision
+);
+
+INSERT INTO city (state_id, city_name, county_id, region_id) VALUES (1, 'Temp City', 1, 1);
+
+CREATE TABLE member (
+member_id                              integer primary key,
+member_name                            text UNIQUE,
+member_login                   text UNIQUE,
+member_passwd                  text,
+street                                 text,
+lat                                            double precision,
+lon                                            double precision,
+country                                        text,
+phone                                  text,
+fax                                            text,
+process_email                  text,
+url                                            text,
+city                                   text,
+state                                  text,
+description                            text,
+create_date                            date DEFAULT current_date,
+zip                                            text,
+toll_free                              text,
+member_contact_email   text,
+state_id                               integer references state(state_id) ON DELETE SET NULL,
+spotlight                              boolean,
+city_id                 integer references city(city_id) ON DELETE SET NULL,
+logo                                   text,
+mailing_address                        text,
+primary_contact                        text,
+new_member                             boolean default 0,
+primary_contact_fname   text,
+primary_contact_lname   text,
+active                  boolean default false,
+mailing_city            text,
+mailing_city_id         integer references city(city_id) ON DELETE SET NULL,
+mailing_state_id        integer references state(state_id) ON DELETE SET NULL,
+mailing_zip             text,
+join_date               date,
+region                  integer,
+time_allocated          text,
+type                    text,
+facebook                text,
+twitter                 text,
+myspace                 text,
+linkedin                text,
+blog                    text,
+youtube                 text,
+account_number          text
+);
+
+CREATE TABLE member_accommodations (
+id                             integer PRIMARY KEY,
+reservation_id text,
+num_rooms              integer,
+year_round             boolean default 0,
+member_id              integer REFERENCES member(member_id) ON DELETE CASCADE
+);
+
+CREATE TABLE amenity (
+amenity_id             integer PRIMARY KEY,
+amenity_name   text,
+amenity_icon   text,
+display_form   boolean
+);
+
+CREATE TABLE member_amenity (
+member_amenity_id      integer PRIMARY KEY,
+member_id                      integer REFERENCES member(member_id) ON DELETE CASCADE,
+amenity_id                     integer REFERENCES amenity(amenity_id) ON DELETE CASCADE
+);
+
+CREATE TABLE category (
+category_id            integer PRIMARY KEY,
+name                   text NOT NULL,
+parent_id              integer DEFAULT 0,
+pos                            integer DEFAULT 1,
+accommodations boolean default 0,
+restaurant             boolean default 0,
+golf                   boolean default 0,
+code                   integer
+);
+
+DELETE FROM category;
+INSERT INTO category (name, parent_id, pos, accommodations, restaurant, golf) VALUES ('Parent', 0, 1, 1, 1, 1);
+INSERT INTO category (name, parent_id, pos, accommodations, restaurant, golf) VALUES ('Child', 1, 1, 0, 0, 0);
+INSERT INTO category (name, parent_id, pos, accommodations, restaurant, golf) VALUES ('Sibling', 1, 2, 0, 1, 0);
+INSERT INTO category (name, parent_id, pos, accommodations, restaurant, golf) VALUES ('Grand Child', 2, 1, 0, 0, 1);
+
+CREATE TABLE member_category (
+member_category_id     integer PRIMARY KEY,
+member_id                      integer REFERENCES member(member_id) ON DELETE CASCADE,
+category_id                    integer REFERENCES category(category_id) ON DELETE CASCADE
+);
+
+CREATE TABLE member_contacts (
+id                     integer PRIMARY KEY,
+title          text,
+fname          text NOT NULL,
+lname          text NOT NULL,
+email          text,
+phone          text,
+send_mail      boolean DEFAULT 0,
+member_id      integer REFERENCES member(member_id) ON DELETE CASCADE
+);
+
+CREATE TABLE member_files (
+id                             integer PRIMARY KEY,
+file_contents  text,
+create_date            date DEFAULT current_date,
+original_name  text NOT NULl,
+size                   integer NOT NULL,
+file_name              text NOT NULL,
+name_on_disk   text NOT NULL,
+pending                        boolean DEFAULT 1,
+member_id              integer REFERENCES member(member_id) ON DELETE CASCADE
+);
+
+CREATE TABLE member_golf (
+id                             integer PRIMARY KEY,
+par                            text,
+yardage                        text,
+course_rating  text,
+slope_rating   text,
+walking_course boolean DEFAULT 0,
+holes18                        text,
+holes9                 text,
+member_id              integer REFERENCES member(member_id) ON DELETE CASCADE
+);
+
+CREATE TABLE member_packages (
+id                     integer PRIMARY KEY,
+title          text,
+description    text,
+image          text,
+type           text,
+pending                boolean DEFAULT 1,
+pos         integer,
+sdate       date,
+edate       date,
+member_id      integer REFERENCES member(member_id) ON DELETE CASCADE
+);
+
+CREATE TABLE member_photos (
+id                     integer PRIMARY KEY,
+image          text NOT NULL,
+caption                text,
+pending                boolean DEFAULT 1,
+pos                    integer DEFAULT 1,
+member_id      integer REFERENCES member(member_id) ON DELETE CASCADE
+);
+
+CREATE TABLE member_restaurants (
+id                             integer PRIMARY KEY,
+breakfast              boolean DEFAULT 0,
+breakfast_from text,
+breakfast_to   text,
+brunch                 boolean DEFAULT 0,
+brunch_from            text,
+brunch_to              text,
+lunch                  boolean DEFAULT 0,
+lunch_from             text,
+lunch_to               text,
+dinner                 boolean DEFAULT 0,
+dinner_from            text,
+dinner_to              text,
+alcohol                        boolean DEFAULT 0,
+non_smoking            boolean DEFAULT 0,
+member_id              integer REFERENCES member(member_id) ON DELETE CASCADE
+);
+
+CREATE TABLE member_updates (
+id                     integer PRIMARY KEY,
+field          text,
+'update'       text,
+alter_time     timestamp without time zone DEFAULT current_timestamp,
+db_table       text NOT NULL,
+data_type      text,
+label          text,
+foreign_key    integer,
+member_id      integer REFERENCES member(member_id) ON DELETE CASCADE,
+field_type     text
+);
+
+CREATE TABLE ccard_type (
+ccard_type_id          integer PRIMARY KEY,
+ccard_type_name                text,
+ccard_type_icon                text
+);
+
+DELETE FROM ccard_type;
+INSERT INTO ccard_type(ccard_type_name, ccard_type_icon) VALUES ('Visa', 'cardvisa.gif');
+INSERT INTO ccard_type(ccard_type_name, ccard_type_icon) VALUES ('Master Card', 'cardmaster.gif');
+INSERT INTO ccard_type(ccard_type_name, ccard_type_icon) VALUES ('Discover', 'carddiscover.gif');
+INSERT INTO ccard_type(ccard_type_name, ccard_type_icon) VALUES ('American Express', 'cardamex.gif');
+INSERT INTO ccard_type(ccard_type_name, ccard_type_icon) VALUES ('Dinner', 'carddinner.gif');
+
+CREATE TABLE member_ccard_type (
+member_ccard_type_id   integer PRIMARY KEY,
+member_id                              integer REFERENCES member(member_id) ON DELETE CASCADE,
+ccard_type_id                  integer REFERENCES ccard_type(ccard_type_id) ON DELETE SET NULL
+);
+
+CREATE TABLE payment_types (
+id integer PRIMARY KEY,
+name TEXT NOT NULL,
+category TEXT NOT NULL,
+qcode INTEGER,
+amount numeric(8,2) NOT NULL,
+notes TEXT,
+dynamic_amount BOOLEAN 
+);
+INSERT INTO payment_types (id,name,category,qcode,amount,notes) VALUES (1,'Basic Member','sample',1545,'350.00','notes go here');
+CREATE TABLE billing (
+id integer PRIMARY KEY,
+invoice_id INTEGER,
+account_id INTEGER,
+transaction_time time,
+transaction_date date,
+member_name TEXT,
+member_id INTEGER,
+account_number TEXT NOT NULL,
+billing_type INTEGER NOT NULL,
+amount numeric(11,2) NOT NULL,
+balance numeric(11,2) NOT NULL,
+payment_method INTEGER,
+payment_data TEXT,
+emailed BOOLEAN,
+printed BOOLEAN,
+paid BOOLEAN,
+invoice TEXT,
+notes TEXT
+);
+-- INSERT INTO billing (id,invoice_id,transaction_time,transaction_date,member_name,member_id,account_number,billing_type,amount,balance,payment_method,payment_data,sent_to_member,paid,invoice,notes) VALUES (1,1,'2009-02-02','2009-02-02','member name',1,'4545445','1','350.00','350.00',1,'#45465','f','f','','');
+CREATE TABLE member_account (
+id INTEGER,
+member_id INTEGER,
+account_number TEXT,
+payment_type INTEGER,
+email_invoice BOOLEAN,
+usmail_invoice BOOLEAN,
+fax_invoice BOOLEAN
+);
+-- INSERT INTO member_account (id,member_id,account_number,payment_type,email_invoice,usmail_invoice,fax_invoice) VALUES (1,1,'999999999',1,1,1,1);
diff --git a/Toolkit/Members/files/members-seed.xml b/Toolkit/Members/files/members-seed.xml
new file mode 100644 (file)
index 0000000..e2530c4
--- /dev/null
@@ -0,0 +1,289 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<dataset>
+       <category
+               category_id="1"
+               name="parent"
+               parent_id="0"
+               accommodations="0"
+               restaurant="0"
+               golf="0"
+       />
+       <category
+               category_id="2"
+               name="child"
+               parent_id="1"
+               accommodations="0"
+               restaurant="0"
+               golf="0"
+       />
+       <category
+               category_id="3"
+               name="modules"
+               parent_id="0"
+               accommodations="1"
+               restaurant="1"
+               golf="1"
+       />
+    <region
+        region_id="1"
+        region_name="temp region"
+    />
+    <city
+        city_id="1"
+        state_id="1"
+        city_name="Petoskey"
+    />
+    <city
+        city_id="2"
+        state_id="1"
+        city_name="Harbor Springs"
+    />
+    <city
+        city_id="3"
+        state_id="1"
+        city_name="Gaylord"
+    />
+       <amenity
+               amenity_id="1"
+               amenity_name="Test amenity 1"
+               display_form="1"
+       />
+       <amenity
+               amenity_id="2"
+               amenity_name="Test amenity 2"
+               display_form="1"
+       />
+       <amenity
+               amenity_id="3"
+               amenity_name="Test amenity 3"
+               display_form="1"
+       />
+       <amenity
+               amenity_id="4"
+               amenity_name="Test amenity 4"
+               display_form="1"
+       />
+       <member
+               member_id="1"
+               member_name="AAA Test Business 1"
+               member_login="login1"
+               member_passwd="password1"
+               phone="231-487-0692"
+               process_email="jamie.kahgee+glm_phpunit_members_business1@gmail.com"
+               url="www.gaslightmedia.com"
+               zip="49770"
+               member_contact_email="jamie.kahgee+glm_phpunit_members_business1@gmail.com"
+               state_id="1"
+               city="petoskey"
+        city_id="1"
+               logo="red.jpg"
+               primary_contact="Jamie Kahgee"
+               new_member="0"
+        active="t"
+        type="full"
+        account_number="278378248"
+       />
+       <member
+               member_id="2"
+               member_name="BBB Test Business 2"
+               member_login="login2"
+               member_passwd="password2"
+               phone="231-487-0692"
+               process_email="jamie.kahgee+glm_phpunit_members_business2@gmail.com"
+               url="www.gaslightmedia.com"
+               zip="49770"
+               member_contact_email="jamie.kahgee+glm_phpunit_members_business2@gmail.com"
+               state_id="1"
+               city="petoskey"
+               primary_contact="Jamie Kahgee"
+               new_member="0"
+        active="t"
+        type="full"
+        account_number="278378248"
+       />
+       <member
+               member_id="3"
+               member_name="CCC Test Business 3"
+               member_login="login3"
+               member_passwd="password3"
+               process_email="jamie.kahgee+glm_phpunit_members_business3@gmail.com"
+               url="www.gaslightmedia.com"
+               zip="49770"
+               member_contact_email="jamie.kahgee+glm_phpunit_members_business3@gmail.com"
+               state_id="1"
+               city="petoskey"
+               logo="yellow.jpg"
+               primary_contact="Jamie Kahgee"
+               new_member="0"
+        active="t"
+        type="full"
+        account_number="278378248"
+       />
+       <member_category
+               member_id="1"
+               category_id="3"
+       />
+       <member_category
+               member_id="2"
+               category_id="3"
+       />
+       <member_category
+               member_id="3"
+               category_id="1"
+       />
+       <member_accommodations
+               id="1"
+               num_rooms="33"
+               year_round="1"
+               member_id="1"
+       />
+       <member_amenity
+               member_amenity_id="1"
+               member_id="1"
+               amenity_id="1"
+       />
+       <member_amenity
+               member_amenity_id="2"
+               member_id="1"
+               amenity_id="2"
+       />
+       <member_amenity
+               member_amenity_id="3"
+               member_id="1"
+               amenity_id="3"
+       />
+       <member_ccard_type
+               member_ccard_type_id="1"
+               member_id="1"
+               ccard_type_id="1"
+       />
+       <member_ccard_type
+               member_ccard_type_id="2"
+               member_id="1"
+               ccard_type_id="2"
+       />
+       <member_ccard_type
+               member_ccard_type_id="3"
+               member_id="1"
+               ccard_type_id="3"
+       />
+       <member_ccard_type
+               member_ccard_type_id="4"
+               member_id="1"
+               ccard_type_id="4"
+       />
+       <member_golf
+               id="1"
+               par="67"
+               yardage="4798"
+               course_rating="89"
+               slope_rating="88"
+               walking_course="1"
+               holes18="$75.00"
+               holes9="$40.00"
+               member_id="1"
+       />
+       <member_packages
+               id="1"
+               title="Test title"
+               description="lorem ipsum delor"
+               image="calvin2.jpg"
+               type="special"
+               member_id="1"
+               pending="0"
+       />
+       <member_packages
+               id="2"
+               title="Test title"
+               description="lorem ipsum delor"
+               type="special"
+               member_id="3"
+               pending="0"
+       />
+       <member_restaurants
+               id="1"
+               lunch="1"
+               lunch_from="12pm"
+               lunch_to="3pm"
+               dinner="1"
+               dinner_from="5pm"
+               dinner_to="9pm"
+               alcohol="1"
+               member_id="1"
+       />
+       <member_photos
+               id="1"
+               image="blue.jpg"
+               pos="1"
+               pending="0"
+               member_id="1"
+       />
+       <member_photos
+               id="2"
+               image="green.jpg"
+               pos="2"
+               pending="0"
+               member_id="1"
+       />
+       <member_photos
+               id="3"
+               image="orange.jpg"
+               pos="3"
+               pending="0"
+               member_id="1"
+       />
+    <member_account
+        id="1"
+        member_id="1"
+        payment_type="1"
+        email_invoice="1"
+        usmail_invoice="1"
+        fax_invoice="1"
+    />
+    <billing
+        id="1"
+        invoice_id="1"
+        account_id="1"
+        transaction_time="2009-02-02"
+        transaction_date="2009-02-02"
+        member_name="AAA Test Business 1"
+        member_id="1"
+        account_number="278378248"
+        billing_type="1"
+        amount="350.00"
+        balance="350.00"
+        payment_method="1"
+        paid="1"
+    />
+    <billing
+        id="2"
+        invoice_id="1"
+        account_id="1"
+        transaction_time="2008-02-02"
+        transaction_date="2008-02-02"
+        member_name="AAA Test Business 1"
+        member_id="1"
+        account_number="278378248"
+        billing_type="2"
+        amount="350.00"
+        balance="0.00"
+        payment_method="1"
+        paid="1"
+    />
+    <billing
+        id="3"
+        invoice_id="1"
+        account_id="1"
+        transaction_time="2009-02-02"
+        transaction_date="2009-02-02"
+        member_name="AAA Test Business 1"
+        member_id="1"
+        account_number="278378248"
+        billing_type="1"
+        amount="350.00"
+        balance="350.00"
+        payment_method="1"
+        paid="0"
+    />
+    
+</dataset>
diff --git a/bootstrap.php b/bootstrap.php
new file mode 100644 (file)
index 0000000..d3bc1d1
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+/* 
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * @author steve
+ */
+$_ENV['GLM_HOST_ID'] = 'STEVE';
+
+// TODO: check include path
+ini_set(
+    'include_path',
+    '/var/www/server/app.gaslightmedia.com/glmPEAR'
+    . PATH_SEPARATOR . ini_get('include_path')
+);
+define('TEST_PATH', '/home/steve/NetBeansProjects/www.uptravel.com/');
+
+require_once '/var/www/server/www.uptravel.com/setup.phtml';
+require_once 'Common.php';
+require_once 'Config.php';
+require_once 'IMapper.php';
+require_once 'ITable.php';
+require_once 'Table.php';
+require_once 'Members/Billing/Billing.php';
+require_once 'Members/Billing/Invoices.php';
+require_once 'Members/Billing/PaymentTypes.php';
+require_once 'Members/Billing/Factory.php';
+require_once 'Members/Billing/Statement.php';
+require_once 'Members/Billing/MemberAccount.php';
+require_once 'Members/Billing/MemberLists.php';
+require_once 'HTML/Template/Flexy.php';
diff --git a/configuration.xml b/configuration.xml
new file mode 100644 (file)
index 0000000..01c9683
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+
+<phpunit colors="false">
+    <filter>
+        <blacklist>
+            <directory>/var/www/server/www.uptravel.com/Toolkit/Members/templates</directory>
+            <file>/var/www/server/www.uptravel.com/setup.phtml</file>
+            <file>/var/www/server/www.uptravel.com/setup_functions.phtml</file>
+            <file>/var/www/server/www.uptravel.com/Toolkit/Common.php</file>
+            <file>/var/www/server/www.uptravel.com/Toolkit/Table.php</file>
+        </blacklist>
+        <whitelist>
+            <directory suffix=".php">/var/www/server/www.uptravel.com/Toolkit/Billing</directory>
+        </whitelist>
+    </filter>
+</phpunit>