Ejemplo n.º 1
0
 function returnFailure(Assert $assert)
 {
     $this->test->test('bar', function (Assert $assert) {
         $assert->fail();
     });
     $this->executeCommand($assert, [], 1);
 }
Ejemplo n.º 2
0
 function incompleteTest(Assert $assert)
 {
     $this->suite->test('one', function (Assert $assert) {
         $assert->incomplete('Not done');
     });
     $this->runAndAssertOutput($assert, ['Foo', 'Foo::one -> Incomplete', '', '---- Incomplete ----', 'Foo::one [FILE:-11]', '    Not done', '', '=| 1 Incomplete']);
 }
Ejemplo n.º 3
0
 function detailedFailureDescription(Assert $assert)
 {
     $this->suite->test('one', function (Assert $assert) {
         $assert->fail('Oh no!');
     });
     $this->suite->test('two', function (Assert $assert) {
         $assert->fail('Not this one');
     });
     $this->runAndAssertOutput($assert, ['FAILED: Foo::one', '   Source:', '      FILE:-25', '   Code:', '      $assert->fail(\'Oh no!\');', '   Message:', '      Failed', '      Oh no!', '', 'FAILED: Foo::two', '   Source:', '      FILE:-22', '   Code:', '      $assert->fail(\'Not this one\');', '   Message:', '      Failed', '      Not this one', '', '2 ran, 2 FAILED =(']);
 }
Ejemplo n.º 4
0
 function mixedResults(Assert $assert)
 {
     $this->suite->test('one', function () {
     });
     $this->suite->test('two', function (Assert $assert) {
         $assert->pass();
     });
     $this->suite->test('three', function (Assert $assert) {
         $assert->fail('Miserably');
     });
     $this->suite->test('four', function (Assert $assert) {
         $assert->pass();
     });
     $this->suite->test('five', function () {
     });
     $this->runAndAssertOutput($assert, ['I.F.I', '', '---- Incomplete ----', 'Foo::one [FILE:-28]', '    No assertions made', 'Foo::five [FILE:-17]', '    No assertions made', '', '---- Failed ----', 'Foo::three [FILE:-23]', '    Failed', '    Miserably', '', '=( 2 Passed, 2 Incomplete, 1 Failed']);
 }
Ejemplo n.º 5
0
 function failAssertion(Assert $assert)
 {
     $assert->isTrue(false);
 }
Ejemplo n.º 6
0
 public function that(Assertion $assertion, $message = "")
 {
     $this->parent->that(new OppositeAssertion($assertion), $message);
 }
Ejemplo n.º 7
0
    function assertOfStaticSuiteIsPassedToInjectedObject(Assert $assert)
    {
        $this->files->givenTheFile_Containing('inject/InjectAssertStatic.php', '<?php
            /** @property InjectedThing $that <- */
            class InjectAssertStatic extends ' . StaticTestSuite::class . ' {
                function foo() {
                    $this->that->assert->pass();
                }

                function bar() {
                }
            }

            /** @property ' . Assert::class . ' $assert <- */
            class InjectedThingStatic {}
        ');
        $this->runFileTestSuite('inject/InjectAssertStatic.php');
        $assert->isInstanceOf($this->listener->results[0], PassedTestResult::class);
        $assert->isInstanceOf($this->listener->results[1], IncompleteTestResult::class);
    }
Ejemplo n.º 8
0
 public function foo(Assert $asserter)
 {
     $asserter->pass();
 }