public function setUp()
 {
     $connection = WealthbotMySqlSqliteConnection::getInstance();
     $sql = "SELECT * FROM " . BaseRepository::TABLE_SYSTEM_ACCOUNT . " ORDER BY id ASC LIMIT 1";
     $result = $connection->query($sql);
     $this->account = new Account();
     $this->account->loadFromArray($result[0]);
     $this->repository = new DistributionRepository();
     $this->businessCalendar = new BusinessCalendar();
 }
Esempio n. 2
0
 public function findAccountById($accountId)
 {
     $sql = "SELECT a.*, IFNULL(SUM(bi.feeBilled), 0) as billing_cash\n                FROM " . self::TABLE_SYSTEM_ACCOUNT . " a\n                LEFT JOIN " . self::TABLE_BILL_ITEM . " bi ON (bi.system_account_id = a.id AND bi.status = :status)\n                WHERE a.id = :accountId\n                GROUP BY a.id";
     $parameters = array('accountId' => $accountId, 'status' => self::STATUS_BILL_APPROVED);
     $result = $this->db->query($sql, $parameters);
     if (!isset($result[0])) {
         return null;
     }
     $account = new Account();
     $account->loadFromArray($result[0]);
     return $account;
 }
Esempio n. 3
0
 public function setUp()
 {
     $data = array('id' => 1, 'type' => Account::TYPE_PERSONAL_INVESTMENT, 'status' => Account::STATUS_INIT_REBALANCE, 'isFirstTime' => true, 'isActiveEmployer' => true, 'isReadyToRebalance' => true, 'scheduledDistribution' => 15000, 'oneTimeDistribution' => 3450, 'cashBuffer' => 2300, 'sasCash' => 3000, 'billingCash' => 3400, 'totalCash' => 30000, 'cashForBuy' => 200, 'client' => array('id' => 28), 'securities' => array(array('id' => 1), array('id' => 2)));
     $this->account = $this->getMockBuilder('Model\\WealthbotRebalancer\\Account')->disableOriginalConstructor()->setMethods(null)->getMock();
     $this->account->loadFromArray($data);
 }