/** * Returns a PHPUnit_Framework_Constraint_IsType matcher object. * * @param string $type * @return PHPUnit_Framework_Constraint_IsType * @since Method available since Release 3.0.0 */ function isType($type) { return PHPUnit_Framework_Assert::isType($type); }
/** * @covers PHPUnit_Framework_Constraint_IsType * @covers PHPUnit_Framework_Constraint_Not * @covers PHPUnit_Framework_Assert::isType * @covers PHPUnit_Framework_Assert::logicalNot */ public function testConstraintIsNotType2() { $constraint = PHPUnit_Framework_Assert::logicalNot(PHPUnit_Framework_Assert::isType('string')); try { $constraint->fail('', 'custom message', TRUE); } catch (PHPUnit_Framework_ExpectationFailedException $e) { $this->assertEquals("custom message\nFailed asserting that <string:> is not of type \"string\".", $e->getDescription()); return; } $this->fail(); }
/** * @covers PHPUnit_Framework_Constraint_IsType * @covers PHPUnit_Framework_Constraint_Not * @covers PHPUnit_Framework_Assert::isType * @covers PHPUnit_Framework_Assert::logicalNot * @covers PHPUnit_Framework_TestFailure::exceptionToString */ public function testConstraintIsNotType2() { $constraint = PHPUnit_Framework_Assert::logicalNot(PHPUnit_Framework_Assert::isType('string')); try { $constraint->evaluate('', 'custom message'); } catch (PHPUnit_Framework_ExpectationFailedException $e) { $this->assertEquals(<<<EOF custom message Failed asserting that '' is not of type "string". EOF , PHPUnit_Framework_TestFailure::exceptionToString($e)); return; } $this->fail(); }
/** * @When I request to authenticate */ public function iRequestToAuthenticate() { try { $this->apiResponse = $this->api->getToken($this->credentials); } catch (Exception $e) { $this->apiResponse = $e->getMessage(); } PHPUnit_Framework_Assert::isType("array"); }
public function toBeJson() { if ($this->negate) { a::assertThat($this->actual, a::logicalAnd(a::isType('string'), a::logicalNot(a::isJson()))); } else { a::assertJson($this->actual); } }
/** * @Given /^the "([^"]*)" property is a string$/ */ public function thePropertyIsAString($property) { $payload = $this->getScopePayload(); PHPUnit_Framework_Assert::isType('string', $this->arrayGet($payload, $property), "Asserting the [{$property}] property in current scope [{$this->scope}] is a string: " . json_encode($payload)); }