/** * Calls assertEmpty() or assertThat() depending on the PHPUnit version. * Available from PHPUnit >= 3.5 * * @param mixed $actual Actual value * @param string $message Message to print if assertion is wrong */ public static function assertEmpty($actual, $message = '') { if (self::_checkMethod('assertEmpty')) { parent::assertEmpty($actual, $message); } else { parent::assertThat($actual, parent::isEmpty(), $message); } }
/** * Assert a cache hit. * * @param ResponseInterface $response * @param string $message Test failure message (optional) */ public function assertHit(ResponseInterface $response, $message = null) { \PHPUnit_Framework_TestCase::assertThat($response, self::isCacheHit(), $message); }
/** * Assert that the given configuration values, when processed, will equal to the given array. * * Optionally provide the part of the configuration that you want to test, e.g. "doctrine.orm" * * @param array $configurationValues * @param array $expectedProcessedConfiguration * @param string|null $breadcrumbPath */ protected function assertProcessedConfigurationEquals(array $configurationValues, array $expectedProcessedConfiguration, $breadcrumbPath = null) { \PHPUnit_Framework_TestCase::assertThat($expectedProcessedConfiguration, new ProcessedConfigurationEqualsConstraint($this->getConfiguration(), $configurationValues, $breadcrumbPath)); }
/** * Asserts that a given value contains the specified number of elements * * @param Integer $expected The expected value * @param Mixed $actual The value to compare * @return null */ public static function assertCount($expected, $actual) { \PHPUnit_Framework_TestCase::assertThat($actual, new \PHPUnit_Framework_Constraint_IsInstanceOf('\\Traversable')); \PHPUnit_Framework_TestCase::assertThat(self::sizeOf($expected * 1.5, $actual), new \PHPUnit_Framework_Constraint_IsEqual($expected)); }
/** * Asserts that the given value produces the expected result when iterated over * * @return null */ public static function assert($expected, $actual) { \PHPUnit_Framework_TestCase::assertThat($actual, new self($expected)); }
/** * Assert that the response view has name * * @param string $name * @param string $message */ public function assertView($name, $message = '') { PHPUnit::assertThat($name, new ConstraintView($this->response), $message); }
/** * @param object $instance * @param string $propertyName * @param mixed $testValue * @param string $message */ public static function assertPropertyGetterReturnsSetValue($instance, $propertyName, $testValue, $message = '') { \PHPUnit_Framework_TestCase::assertThat($instance, self::propertyGetterReturnsSetValue($propertyName, $testValue), $message); }
/** * Asserts that no Doobie markers have expired. * * @param \BartFeenstra\Doobie\FileFinder\FileFinderInterface[] $file_finders * @param \BartFeenstra\Doobie\Parser\ParserInterface[] $parsers * @param \BartFeenstra\Doobie\Constraint\ConstraintEvaluatorInterface[] $constraint_evaluators */ public function assertDoobieMarkers(array $file_finders, array $parsers, array $constraint_evaluators) { $constraint = new DoobieMarkerAssert($file_finders, $parsers, $constraint_evaluators); \PHPUnit_Framework_TestCase::assertThat(NULL, $constraint); }
/** * @param string $pattern * @param mixed $value * @param string $message */ protected function assertMatchesPattern($pattern, $value, $message = '') { \PHPUnit_Framework_TestCase::assertThat($value, self::matchesPattern($pattern), $message); }
protected function assertBinaryEqual($expected, $actual, $message = '') { $constraint = new IsBinaryEqual($expected); PHPUnit_Framework_TestCase::assertThat($actual, $constraint, $message); }
/** * @param integer $lowerLimitAmount * @param Member $forMember * @param string $message */ public static function assertBalanceIsGreaterThan($lowerLimitAmount, Member $forMember, $message = '') { TestCase::assertThat($forMember->information()->accountBalance(), self::isBalanceAmountGreaterThan($lowerLimitAmount), $message); }
/** * Profiles the callback and test the result against the given configuration. */ public function assertPhpUnit(\PHPUnit_Framework_TestCase $testCase, Profile\Configuration $config, $callback) { if (!$config->hasMetadata('skip_timeline')) { $config->setMetadata('skip_timeline', 'true'); } try { $probe = $this->createProbe($config); $callback(); $profile = $this->endProbe($probe); $testCase->assertThat($profile, new BlackfireConstraint()); } catch (Exception\ExceptionInterface $e) { $testCase->markTestSkipped($e->getMessage()); } return $profile; }