本文整理汇总了PHP中bovigo\assert\predicate\equals函数的典型用法代码示例。如果您正苦于以下问题:PHP equals函数的具体用法?PHP equals怎么用?PHP equals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了equals函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writesToStandardOutputBuffer
/**
* @test
*/
public function writesToStandardOutputBuffer()
{
$out = new StandardOutputStream();
ob_start();
$out->write('foo');
assert(ob_get_contents(), equals('foo'));
ob_end_clean();
}
示例2: canIterateOverNonSeekableInputStream
/**
* @test
*/
public function canIterateOverNonSeekableInputStream()
{
$inputStream = NewInstance::of(InputStream::class)->mapCalls(['readLine' => onConsecutiveCalls('foo', 'bar', 'baz', ''), 'eof' => onConsecutiveCalls(false, false, false, true)]);
$content = [];
foreach (linesOf($inputStream) as $lineNumber => $line) {
$content[$lineNumber] = $line;
}
assert($content, equals([1 => 'foo', 2 => 'bar', 3 => 'baz']));
}
示例3: keyConsumerIsNotCalledWhenNoKeyInForeachRequested
/**
* @test
*/
public function keyConsumerIsNotCalledWhenNoKeyInForeachRequested()
{
$i = 0;
$peek = new Peek(new \ArrayIterator(['foo' => 303, 'bar' => 404, 'baz' => 505]), function () {
}, function () {
fail('Key consumer is not expected to be called');
});
foreach ($peek as $value) {
$i++;
}
assert($i, equals(3));
}
示例4: infiniteGeneratorDoesStopOnlyWhenBreakOutOfLoop
/**
* @test
*/
public function infiniteGeneratorDoesStopOnlyWhenBreakOutOfLoop()
{
$i = 0;
foreach (Generator::infinite(0, function ($value) {
return $value + 2;
}) as $key => $value) {
if (1000 > $key) {
$i++;
} else {
break;
}
}
assert($i, equals(1000));
}
示例5: parseRecognizesHttpsUris
/**
* @test
*/
public function parseRecognizesHttpsUris()
{
assert(Parse::toType('https://example.net/'), equals(HttpUri::fromString('https://example.net/')));
}
示例6: handleSignalsResultOfResponsibleErrorHandlerIfErrorReportingEnabled
/**
* @test
*/
public function handleSignalsResultOfResponsibleErrorHandlerIfErrorReportingEnabled()
{
$oldLevel = error_reporting(E_ALL);
try {
$this->errorHandler1->mapCalls(['isResponsible' => false]);
$this->errorHandler2->mapCalls(['isResponsible' => true, 'isSupressable' => false, 'handle' => ErrorHandler::STOP_ERROR_HANDLING]);
assert($this->errorHandlers->handle(1, 'foo'), equals(ErrorHandler::STOP_ERROR_HANDLING));
} finally {
error_reporting($oldLevel);
}
}
示例7: writeLinesWritesBytesIntoBuffer
/**
* @test
* @since 3.2.0
*/
public function writeLinesWritesBytesIntoBuffer()
{
$this->memoryOutputStream->writeLines(['hello', 'world']);
assert($this->memoryOutputStream->buffer(), equals("hello\nworld\n"));
}
示例8: typeOfOtherValuesReturnsNativeType
/**
* @param mixed $value
* @param string $expectedType
* @test
* @dataProvider valueTypes
* @since 7.0.0
*/
public function typeOfOtherValuesReturnsNativeType($value, string $expectedType)
{
assert(typeOf($value), equals($expectedType));
}
示例9: deleteWritesCorrectRequestWithVersion
/**
* @since 2.0.0
* @test
*/
public function deleteWritesCorrectRequestWithVersion()
{
$this->createHttpRequest()->delete(5, HttpVersion::HTTP_1_0);
assert($this->memory, equals(Http::lines('DELETE /foo/resource HTTP/1.0', 'Host: example.com', 'X-Binford: 6100', '')));
}
示例10: returnsParsedValuesForCommonProperties
/**
* @test
* @since 4.1.0
*/
public function returnsParsedValuesForCommonProperties()
{
assert($this->createPropertyBinding('DEV')->getInstance($this->injector, 'baz'), equals(reflect(Properties::class)));
}
示例11: bytesLeftCallsDecoratedStream
/**
* @test
*/
public function bytesLeftCallsDecoratedStream()
{
assert($this->decoratedInputStream->bytesLeft(), equals(4));
}
示例12: writeLinesPassesBytesWithLinebreakIntoStream
/**
* @test
* @since 3.2.0
*/
public function writeLinesPassesBytesWithLinebreakIntoStream()
{
$file = vfsStream::newFile('test.txt')->at($this->root);
$resourceOutputStream = $this->createResourceOutputStream(fopen(vfsStream::url('root/test.txt'), 'w'));
assert($resourceOutputStream->writeLines(['foo', 'bar', 'baz']), equals(15));
assert($file->getContent(), equals("foo\r\nbar\r\nbaz\r\n"));
}
示例13: partitioningByWithSum
/**
* @test
*/
public function partitioningByWithSum()
{
assert(Sequence::of($this->people)->collect()->inPartitions(function (Employee $e) {
return $e->years() > 10;
}, Collector::forSum(function (Employee $e) {
return $e->years();
})), equals([true => 29, false => 4]));
}
示例14: startsAtPositionZero
/**
* @test
* @since 8.0.0
*/
public function startsAtPositionZero()
{
assert($this->standardInputStream->tell(), equals(0));
}
示例15: headerListCanBeCastedToString
/**
* @test
* @since 7.0.0
*/
public function headerListCanBeCastedToString()
{
$headers = "Binford: 6100\r\nX-Power: More power!";
assert((string) parseHeaders($headers), equals($headers));
}