我正在尝试创建一个Constants.php类来存储同一项目中多个测试的常量。
设置
Laravel 4 with Selenium
PhpStorm IDE
我的第一次测试的文件夹结构:
Selenium
- Constants.php
- CriticalTests
- - GrabProductInfoCept.php
Constants.php的内容
<?php
class Constants {
// Product Variables
public static $product_to_search = 107049;
// Email Variables
public static $vendor_email = 'EMAIL REMOVED';
public static $affiliate_email = 'EMAIL REMOVED';
GrabProductInfoCept.php的内容
<?php
$I = new SeleniumGuy\UserSteps($scenario);
$I->wantTo('can verify product dump information');
// Log In first...
$I->amOnPage('/auth/login');
$I->see('Vendor / Affiliate Login');
$I->successfullyLogin();
$I->see('Your JVZoo Account Overview');
// Grab the product name
$I->amOnPage('/products/edit/' . \Constants::$product_to_search);
$I->see('Add Product Information');
$to_match = $I->grabValueFrom('product_name');
// Get to the right page
$I->amOnPage('/b/p/' . \Constants::$product_to_search .'/2');
$I->see('Order Review:');
$I->fillField('contact_email', \Constants::$vendor_email);
$I->fillField('paypal_email', \Constants::$affiliate_email);
$I->click('paypal_checkout');
$I->see('Your payment summary');
// Grab the paykey
$paykey = $I->grabFromCurrentUrl('/paykey=(.{20})/');
// Now test the transaction dump
$I->amOnPage('transactions/lookup');
$I->see('Transaction Lookup');
$I->fillField('paykey', $paykey);
$I->click('lookup');
$I->see('Transaction:');
// And make sure you've got the right transaction!
$I->see(\Constants::$product_to_search);
$I->see(\Constants::$vendor_email);
$I->see($paykey);
结果: 测试在第一次\ Constansts :: $ product_to_search调用时消失。我在这做错了什么?我无法找到有关常量文件的大量文档。