Skip to content

Instantly share code, notes, and snippets.

@koriym
Created October 23, 2011 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koriym/1307280 to your computer and use it in GitHub Desktop.
Save koriym/1307280 to your computer and use it in GitHub Desktop.
PHP用DIコンテナRayテスト
必要なもの
* PHP 5.3+ / 5.4
* phpunit
以下のコマンドをターミナルで入力します。
$ mkdir raytest
$ cd raytest
$ git clone git@github.com:koriym/Ray.Di.git
$ cd Ray.Di
$ git submodule update --init
$ phpunit
$ php doc/sample-01-db/main.php
$ cd ../..
$ rm -rf raytest
PHPとphpunitのバージョン、エラー有無&内容をコメントで教えて下さい。
$ php -v
$ phpunit -v
問題なければ以下のように表示出力されます。
OK (109 tests, 135 assertions)
Timer start
begin Transaction["Koriym",35]
commit
Timer stop:[0.0008380] sec
Timer start
begin Transaction["Bear",19]
commit
Timer stop:[0.0001712] sec
Timer start
begin Transaction["Yoshi",25]
commit
Timer stop:[0.0001609] sec
'Name:Koriym Age:35
Name:Bear Age:19
Name:Yoshi Age:25
OK (21 tests, 22 assertions)
ご協力ありがとうございます。
@k-holy
Copy link

k-holy commented Oct 24, 2011

XAMPP1.7.4でテストしました。Windowsのコマンドプロンプトなのでエスケープシーケンスが効いていませんが、テストケースは全てグリーン(表示は白ですが…)でした。
PHP 5.3.5 (cli)
PHPUnit 3.5.14

@koriym
Copy link
Author

koriym commented Oct 24, 2011

k-holyさん
ありがとうございます。

@madapaja
Copy link

madapaja commented Dec 5, 2011

以下の環境でテストしましたが問題ありませんでした。

$ php -v
PHP 5.4.0RC2 (cli) (built: Dec  5 2011 11:35:36)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2011 Zend Technologies

$ phpunit --version
PHPUnit 3.6.4 by Sebastian Bergmann.

$ phpunit
PHPUnit 3.6.4 by Sebastian Bergmann.

The Xdebug extension is not loaded. No code coverage will be generated.


...............................................................  63 / 105 ( 60%)
..........................................

Time: 0 seconds, Memory: 6.25Mb

OK (105 tests, 132 assertions)

$ php doc/sample-01-db/main.php
Timer start
begin Transaction["Koriym",29]
commit
Timer stop:[0.0001371] sec

Timer start
begin Transaction["Bear",22]
commit
Timer stop:[0.0000699] sec

Timer start
begin Transaction["Yoshi",20]
commit
Timer stop:[0.0000870] sec

'Name:Koriym    Age:29
Name:Bear       Age:22
Name:Yoshi      Age:20
'

@koriym
Copy link
Author

koriym commented Dec 5, 2011

madapajaさん
ありがとうございます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment