function testGetInfo()
 {
     $email = '*****@*****.**';
     WebfinanceUser::Create($email);
     $new_company = array('name' => 'ACME', 'address1' => '1110 Gateway Drive', 'zip_code' => 'CA 94404', 'city' => 'San Mateo', 'country' => 'US', 'email' => $email);
     $company_id = WebfinanceCompany::Create($new_company);
     $company = new WebfinanceCompany($company_id);
     $company_info = $company->GetInfo();
     $this->assertEquals($new_company['name'], $company_info['name']);
 }
示例#2
0
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program. If not, see <http://www.gnu.org/licenses/>.
//
require_once '../htdocs/inc/sso.php';
require_once '../htdocs/inc/smarty.php';
try {
    // Create user if he/she does not exist yet
    try {
        WebfinanceUser::ValidateExists($_SESSION['cybsso_user']['email']);
    } catch (Exception $e) {
        WebfinanceUser::Create($_SESSION['cybsso_user']['email']);
    }
    $user = new WebfinanceUser($_SESSION['cybsso_user']['email']);
    // Ask the user to create a company if he/she doesn't own one
    if (count($user->GetCompanies()) == 0) {
        header('Location: /company/new');
        exit;
    }
    /*
    si return_url est définie, alors on redirige (dans le cas de la creation d'un
    compte)
    redirect $return_url
    */
    /*
    
    Si l'utilisateur a >=1 societe, on affiche les devis, factures, coordonnées,
 function testGetIdFromEmailOK()
 {
     $email = '*****@*****.**';
     $user_id = WebfinanceUser::Create($email);
     $this->assertEquals($user_id, WebfinanceUser::GetIdFromEmail($email));
 }