예제 #1
0
파일: spec.php 프로젝트: rstuven/pecs
     $spec = new pecs\Spec();
     expect($spec->passed())->to_be_true();
     expect($spec->failed())->to_be_false();
 });
 it("should not pass if fail is called", function () {
     $spec = new pecs\Spec();
     $spec->fail('boat');
     expect($spec->passed())->to_be_false();
     expect($spec->failed())->to_be_true();
 });
 it("should allow fail to be called more than once", function () {
     $spec = new pecs\Spec();
     $spec->fail('boat');
     $spec->fail('whale');
     expect($spec->passed())->to_be_false();
     expect($spec->failed())->to_be_true();
     expect($spec->failures)->to_have_count(2);
 });
 it("should convert failure strings to exceptions", function () {
     $spec = new pecs\Spec();
     $spec->fail('boat');
     expect($spec->failures)->to_have_count(1);
     $failure = $spec->failures[0];
     expect($failure)->to_be_an_instance_of('Exception');
     expect($failure->getMessage())->to_be('boat');
 });
 it("should invoke the function once when run", function () {
     $called = 0;
     $spec = new pecs\Spec(null, function () use(&$called) {
         $called += 1;
     });