本文整理汇总了PHP中bovigo\assert\predicate\equals函数的典型用法代码示例。如果您正苦于以下问题:PHP equals函数的具体用法?PHP equals怎么用?PHP equals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了equals函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: writesToStandardOutputBuffer
/**
* @test
*/
public function writesToStandardOutputBuffer()
{
$out = new StandardOutputStream();
ob_start();
$out->write('foo');
assert(ob_get_contents(), equals('foo'));
ob_end_clean();
}
开发者ID:stubbles,项目名称:stubbles-streams,代码行数:11,代码来源:StandardOutputStreamTest.php
示例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']));
}
开发者ID:stubbles,项目名称:stubbles-streams,代码行数:12,代码来源:InputStreamIteratorTest.php
示例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));
}
开发者ID:stubbles,项目名称:stubbles-sequence,代码行数:15,代码来源:PeekTest.php
示例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));
}
开发者ID:stubbles,项目名称:stubbles-sequence,代码行数:17,代码来源:GeneratorTest.php
示例5: parseRecognizesHttpsUris
/**
* @test
*/
public function parseRecognizesHttpsUris()
{
assert(Parse::toType('https://example.net/'), equals(HttpUri::fromString('https://example.net/')));
}
开发者ID:stubbles,项目名称:stubbles-peer,代码行数:7,代码来源:ParseTest.php
示例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);
}
}
开发者ID:stubbles,项目名称:stubbles-ioc,代码行数:14,代码来源:ErrorHandlersTest.php
示例7: writeLinesWritesBytesIntoBuffer
/**
* @test
* @since 3.2.0
*/
public function writeLinesWritesBytesIntoBuffer()
{
$this->memoryOutputStream->writeLines(['hello', 'world']);
assert($this->memoryOutputStream->buffer(), equals("hello\nworld\n"));
}
开发者ID:stubbles,项目名称:stubbles-streams,代码行数:9,代码来源:MemoryOutputStreamTest.php
示例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));
}
开发者ID:stubbles,项目名称:stubbles-values,代码行数:11,代码来源:FunctionsTest.php
示例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', '')));
}
开发者ID:stubbles,项目名称:stubbles-peer,代码行数:9,代码来源:HttpRequestTest.php
示例10: returnsParsedValuesForCommonProperties
/**
* @test
* @since 4.1.0
*/
public function returnsParsedValuesForCommonProperties()
{
assert($this->createPropertyBinding('DEV')->getInstance($this->injector, 'baz'), equals(reflect(Properties::class)));
}
开发者ID:stubbles,项目名称:stubbles-ioc,代码行数:8,代码来源:PropertyBindingTest.php
示例11: bytesLeftCallsDecoratedStream
/**
* @test
*/
public function bytesLeftCallsDecoratedStream()
{
assert($this->decoratedInputStream->bytesLeft(), equals(4));
}
开发者ID:stubbles,项目名称:stubbles-streams,代码行数:7,代码来源:DecoratedInputStreamTest.php
示例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"));
}
开发者ID:stubbles,项目名称:stubbles-streams,代码行数:11,代码来源:ResourceOutputStreamTest.php
示例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]));
}
开发者ID:stubbles,项目名称:stubbles-sequence,代码行数:11,代码来源:CollectorsTest.php
示例14: startsAtPositionZero
/**
* @test
* @since 8.0.0
*/
public function startsAtPositionZero()
{
assert($this->standardInputStream->tell(), equals(0));
}
开发者ID:stubbles,项目名称:stubbles-streams,代码行数:8,代码来源:StandardInputStreamTest.php
示例15: headerListCanBeCastedToString
/**
* @test
* @since 7.0.0
*/
public function headerListCanBeCastedToString()
{
$headers = "Binford: 6100\r\nX-Power: More power!";
assert((string) parseHeaders($headers), equals($headers));
}
开发者ID:stubbles,项目名称:stubbles-peer,代码行数:9,代码来源:HeaderListTest.php
示例16: createInputStreamUsesGivenStringAsStreamContent
/**
* @test
*/
public function createInputStreamUsesGivenStringAsStreamContent()
{
$memoryInputStream = $this->memoryStreamFactory->createInputStream('buffer');
assert($memoryInputStream->readLine(), equals('buffer'));
}
开发者ID:stubbles,项目名称:stubbles-streams,代码行数:8,代码来源:MemoryStreamFactoryTest.php
示例17: exportsAnyThingElseWithDefault
/**
* @test
*/
public function exportsAnyThingElseWithDefault()
{
assert(Provides::values([1])->describeValue(exporter(), 'foo'), equals('\'foo\''));
}
开发者ID:stubbles,项目名称:stubbles-sequence,代码行数:7,代码来源:ProvidesTest.php
示例18: mixedAnnotations
/**
* @test
*/
public function mixedAnnotations()
{
$plugin = NewInstance::of(Plugin::class);
$binder = new Binder();
$binder->bindList('listConfig');
$binder->bindMap('mapConfig');
$binder->bind(Plugin::class)->named('foo')->toInstance($plugin);
$binder->bindConstant('foo')->to(42);
$binder->bindList('aList')->withValue(313);
$binder->bindMap('aMap')->withEntry('tb', 303);
assert($this->createPluginHandler($binder)->getArgs(), equals(['std' => $plugin, 'answer' => 42, 'list' => [313], 'map' => ['tb' => 303]]));
}
开发者ID:stubbles,项目名称:stubbles-ioc,代码行数:15,代码来源:MultibindingTest.php
示例19: namedConstructorInjectionWithMultipleParamAndNamedParamGroup
/**
* @test
*/
public function namedConstructorInjectionWithMultipleParamAndNamedParamGroup()
{
$binder = new Binder();
$binder->bind(Employee::class)->named('schst')->to(Boss::class);
$binder->bind(Employee::class)->to(TeamMember::class);
$injector = $binder->getInjector();
$group = $injector->getInstance(DevelopersMultipleConstructorParamsGroupedName::class);
assert($group, equals(new DevelopersMultipleConstructorParamsGroupedName(new Boss(), new Boss())));
}
开发者ID:stubbles,项目名称:stubbles-ioc,代码行数:12,代码来源:InjectorNamedTest.php
示例20: writeLinesReturnsOnlyAmountOfUnfilteredBytedWritten
/**
* @test
* @since 8.0.0
*/
public function writeLinesReturnsOnlyAmountOfUnfilteredBytedWritten()
{
assert($this->filteredOutputStream->writeLines(['foo', 'bar']), equals(4));
}
开发者ID:stubbles,项目名称:stubbles-streams,代码行数:8,代码来源:FilteredOutputStreamTest.php
注:本文中的bovigo\assert\predicate\equals函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论