當前位置: 首頁>>代碼示例>>PHP>>正文


PHP predicate\equals函數代碼示例

本文整理匯總了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();
 }
開發者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


注:本文中的bovigo\assert\predicate\equals函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。