Gajus\Vlad\Test::assert PHP Method

assert() public method

Add an assertion about a $selector_name to the test.
public assert ( string $selector_name ) : Gajus\Vlad\Assertion
$selector_name string
return Gajus\Vlad\Assertion
    public function assert($selector_name)
    {
        $assertion = new \Gajus\Vlad\Assertion();
        $this->test[$selector_name][] = $assertion;
        return $assertion;
    }

Usage Example

Beispiel #1
0
 /**
  * @depends testBuildTest
  */
 public function testAssessFailingTest(\Gajus\Vlad\Test $test)
 {
     $test->assert('foo')->is('String');
     $assessment = $test->assess(['foo' => new \stdClass()]);
     $this->assertCount(1, $assessment);
     $this->assertSame('Foo is not a string.', $assessment[0]);
 }