PHP Class Eccube\Tests\EccubeTestCase

Author: Kentaro Ohkouchi
Inheritance: extends Silex\WebTestCase
Mostrar archivo Open project: ec-cube/ec-cube Class Usage Examples

Protected Properties

Property Type Description
$actual
$expected

Public Methods

Method Description
createApplication ( )
createCustomer ( string $email = null ) : Customer Customer オブジェクトを生成して返す.
createCustomerAddress ( Customer $Customer, boolean $is_nonmember = false ) : CustomerAddress CustomerAddress を生成して返す.
createMember ( string $username = null ) : Eccube\Entity\Member Member オブジェクトを生成して返す.
createNonMember ( string $email = null ) : Customer 非会員の Customer オブジェクトを生成して返す.
createOrder ( Customer $Customer ) : Order Order オブジェクトを生成して返す.
createPageLayout ( ) : Eccube\Entity\PageLayout PageLayout オブジェクトを生成して返す
createPayment ( Eccube\Entity\Delivery $Delivery, string $method, integer $charge, integer $rule_min, integer $rule_max = 999999999 ) : Eccube\Entity\Payment Payment オプジェクトを生成して返す.
createProduct ( string $product_name = null, integer $product_class_num = 3 ) : Product Product オブジェクトを生成して返す.
deleteAllRows ( array $tables ) テーブルのデータを全て削除する.
getFaker ( string $locale = 'ja_JP' ) : Faker\Factory\Generator Faker を生成する.
initializeDatabase ( ) データベースを初期化する.
setUp ( ) Applicaiton を生成しトランザクションを開始する.
tearDown ( ) トランザクションをロールバックする.
verify ( string $message = '' ) Expected と Actual を比較する.

Protected Methods

Method Description
checkMailCatcherStatus ( ) MailCatcher の起動状態をチェックする.
cleanUpMailCatcherMessages ( ) MailCatcher のメッセージをすべて削除する.
cleanUpProperties ( ) PHPUnit_* インスタンスのプロパティを初期化する.
getMailCatcherMessage ( integer $id ) : object MailCatcher のメッセージを ID を指定して取得する.
getMailCatcherMessages ( ) : array MailCatcher のメッセージをすべて取得する.
initializeMailCatcher ( ) MailCatcher を初期化する.
isSqliteInMemory ( ) in the case of sqlite in-memory database.
parseMailCatcherSource ( object $Message ) : string MailCatcher のメッセージソースをデコードする.

Method Details

checkMailCatcherStatus() protected method

MailCatcher が起動していない場合は, テストをスキップする.
protected checkMailCatcherStatus ( )

cleanUpMailCatcherMessages() protected method

MailCatcher のメッセージをすべて削除する.

cleanUpProperties() protected method

このメソッドは、PHPUnit のメモリリーク解消のため、 tearDown() メソッドでコールされる.
protected cleanUpProperties ( )

createApplication() public method

public createApplication ( )

createCustomer() public method

Customer オブジェクトを生成して返す.
public createCustomer ( string $email = null ) : Customer
$email string メールアドレス. null の場合は, ランダムなメールアドレスが生成される.
return Eccube\Entity\Customer

createCustomerAddress() public method

CustomerAddress を生成して返す.
public createCustomerAddress ( Customer $Customer, boolean $is_nonmember = false ) : CustomerAddress
$Customer Eccube\Entity\Customer 対象の Customer インスタンス
$is_nonmember boolean 非会員の場合 true
return Eccube\Entity\CustomerAddress

createMember() public method

Member オブジェクトを生成して返す.
public createMember ( string $username = null ) : Eccube\Entity\Member
$username string . null の場合は, ランダムなユーザーIDが生成される.
return Eccube\Entity\Member

createNonMember() public method

非会員の Customer オブジェクトを生成して返す.
public createNonMember ( string $email = null ) : Customer
$email string メールアドレス. null の場合は, ランダムなメールアドレスが生成される.
return Eccube\Entity\Customer

createOrder() public method

Order オブジェクトを生成して返す.
public createOrder ( Customer $Customer ) : Order
$Customer Eccube\Entity\Customer Customer インスタンス
return Eccube\Entity\Order

createPageLayout() public method

PageLayout オブジェクトを生成して返す
public createPageLayout ( ) : Eccube\Entity\PageLayout
return Eccube\Entity\PageLayout

createPayment() public method

Payment オプジェクトを生成して返す.
public createPayment ( Eccube\Entity\Delivery $Delivery, string $method, integer $charge, integer $rule_min, integer $rule_max = 999999999 ) : Eccube\Entity\Payment
$Delivery Eccube\Entity\Delivery デフォルトで設定する配送オブジェクト
$method string 支払い方法名称
$charge integer 手数料
$rule_min integer 下限金額
$rule_max integer 上限金額
return Eccube\Entity\Payment

createProduct() public method

Product オブジェクトを生成して返す.
public createProduct ( string $product_name = null, integer $product_class_num = 3 ) : Product
$product_name string 商品名. null の場合はランダムな文字列が生成される.
$product_class_num integer 商品規格の生成数
return Eccube\Entity\Product

deleteAllRows() public method

このメソッドは、参照制約の関係で、 Doctrine ORM ではデータ削除できない場合に使用する. 通常は、 EntityManager::remove() を使用して削除すること.
public deleteAllRows ( array $tables )
$tables array 削除対象のテーブル名の配列

getFaker() public method

Faker を生成する.
public getFaker ( string $locale = 'ja_JP' ) : Faker\Factory\Generator
$locale string ロケールを指定する. デフォルト ja_JP
return Faker\Factory\Generator

getMailCatcherMessage() protected method

MailCatcher のメッセージを ID を指定して取得する.
protected getMailCatcherMessage ( integer $id ) : object
$id integer メッセージの ID
return object MailCatcher のメッセージ

getMailCatcherMessages() protected method

MailCatcher のメッセージをすべて取得する.
protected getMailCatcherMessages ( ) : array
return array MailCatcher のメッセージの配列

initializeDatabase() public method

データベースを初期化し、マイグレーションを行なう. 全てのデータが初期化されるため注意すること.
public initializeDatabase ( )

initializeMailCatcher() protected method

このメソッドは主に setUp() メソッドでコールされる. MailCatcher が起動してない場合は, テストをスキップする. MailCatcher については \Eccube\Tests\Service\MailServiceTest のコメントを参照してください
See also: Eccube\Tests\Service\MailServiceTest
protected initializeMailCatcher ( )

isSqliteInMemory() protected method

in the case of sqlite in-memory database.
protected isSqliteInMemory ( )

parseMailCatcherSource() protected method

MailCatcher のメッセージソースをデコードする.
protected parseMailCatcherSource ( object $Message ) : string
$Message object MailCatcher のメッセージ
return string デコードされた eml 形式のソース

setUp() public method

Applicaiton を生成しトランザクションを開始する.
public setUp ( )

tearDown() public method

トランザクションをロールバックする.
public tearDown ( )

verify() public method

Expected と Actual を比較する.
public verify ( string $message = '' )
$message string エラーメッセージ

Property Details

$actual protected_oe property

protected $actual

$expected protected_oe property

protected $expected