• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Expectations类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Expectations的典型用法代码示例。如果您正苦于以下问题:PHP Expectations类的具体用法?PHP Expectations怎么用?PHP Expectations使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Expectations类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _createMessageWithByteCount

 private function _createMessageWithByteCount($bytes)
 {
     $this->_bytes = $bytes;
     $msg = $this->_mock('Swift_Mime_Message');
     $this->_checking(Expectations::create()->ignoring($msg)->toByteStream(any())->calls(array($this, '_write')));
     return $msg;
 }
开发者ID:mahersafadi,项目名称:joindin-api,代码行数:7,代码来源:BandwidthMonitorPluginTest.php


示例2: testRegisterPluginDelegatesToTransport

 public function testRegisterPluginDelegatesToTransport()
 {
     $plugin = $this->_createPlugin();
     $transport = $this->_createTransport();
     $mailer = $this->_createMailer($transport);
     $this->_checking(Expectations::create()->one($transport)->registerPlugin($plugin));
     $mailer->registerPlugin($plugin);
 }
开发者ID:mahersafadi,项目名称:joindin-api,代码行数:8,代码来源:MailerTest.php


示例3: testOverridingTranslationsOnlyAddsNeededFilters

 public function testOverridingTranslationsOnlyAddsNeededFilters()
 {
     $factory = $this->_createFactory();
     $this->_checking(Expectations::create()->one($factory)->createFilter('a', 'b')->returns($this->_createFilter())->one($factory)->createFilter('x', 'y')->returns($this->_createFilter())->never($factory));
     $buffer = $this->_createBuffer($factory);
     $buffer->setWriteTranslations(array('a' => 'b'));
     $buffer->setWriteTranslations(array('x' => 'y', 'a' => 'b'));
 }
开发者ID:abouthalf,项目名称:archies-recipes,代码行数:8,代码来源:StreamBufferTest.php


示例4: testSendingMessageRegeneratesId

 public function testSendingMessageRegeneratesId()
 {
     $buf = $this->_getBuffer();
     $sendmail = $this->_getSendmail($buf);
     $message = $this->_createMessage();
     $this->_checking(Expectations::create()->allowing($message)->getTo()->returns(array('foo@bar' => 'Foobar', 'zip@button' => 'Zippy'))->one($message)->generateId()->ignoring($message)->one($buf)->initialize()->one($buf)->terminate()->one($buf)->setWriteTranslations(array("\r\n" => "\n", "\n." => "\n.."))->one($buf)->setWriteTranslations(array())->ignoring($buf));
     $sendmail->setCommand('/usr/sbin/sendmail -t');
     $this->assertEqual(2, $sendmail->send($message));
 }
开发者ID:abouthalf,项目名称:archies-recipes,代码行数:9,代码来源:SendmailTransportTest.php


示例5: testReportingFailedBcc

 public function testReportingFailedBcc()
 {
     $message = $this->_createMessage();
     $evt = $this->_createSendEvent();
     $reporter = $this->_createReporter();
     $this->_checking(Expectations::create()->allowing($message)->getTo()->returns(array('[email protected]' => 'Foo'))->allowing($message)->getBcc()->returns(array('zip@button' => 'Zip', '[email protected]' => 'Test'))->allowing($evt)->getMessage()->returns($message)->allowing($evt)->getFailedRecipients()->returns(array('zip@button'))->one($reporter)->notify($message, '[email protected]', Swift_Plugins_Reporter::RESULT_PASS)->one($reporter)->notify($message, 'zip@button', Swift_Plugins_Reporter::RESULT_FAIL)->one($reporter)->notify($message, '[email protected]', Swift_Plugins_Reporter::RESULT_PASS)->ignoring($message)->ignoring($evt));
     $plugin = new Swift_Plugins_ReporterPlugin($reporter);
     $plugin->sendPerformed($evt);
 }
开发者ID:mahersafadi,项目名称:joindin-api,代码行数:9,代码来源:ReporterPluginTest.php


示例6: testUnbindingStreamPreventsFurtherWrites

 public function testUnbindingStreamPreventsFurtherWrites()
 {
     $this->_initializeBuffer();
     $is1 = $this->_createMockInputStream();
     $is2 = $this->_createMockInputStream();
     $this->_checking(Expectations::create()->one($is1)->write('x')->one($is2)->write('x')->one($is1)->write('y'));
     $this->_buffer->bind($is1);
     $this->_buffer->bind($is2);
     $this->_buffer->write('x');
     $this->_buffer->unbind($is2);
     $this->_buffer->write('y');
 }
开发者ID:brennantom,项目名称:hackazon,代码行数:12,代码来源:AbstractStreamBufferAcceptanceTest.php


示例7: testFirstLineCanHaveShorterLength

 public function testFirstLineCanHaveShorterLength()
 {
     $charStream = $this->_mock('Swift_CharacterStream');
     $seq = $this->_sequence('byte-sequence');
     $string = '';
     for ($x = 0; $x < 200; ++$x) {
         $char = 'a';
         $string .= $char;
         $this->_checking(Expectations::create()->one($charStream)->read(optional())->inSequence($seq)->returns($char));
     }
     $this->_checking(Expectations::create()->atLeast(1)->of($charStream)->read(optional())->inSequence($seq)->returns(false)->one($charStream)->importString($string)->ignoring($charStream)->flushContents());
     $encoder = new Swift_Encoder_Rfc2231Encoder($charStream);
     $encoded = $encoder->encodeString($string, 25, 75);
     $this->assertEqual(str_repeat('a', 50) . "\r\n" . str_repeat('a', 75) . "\r\n" . str_repeat('a', 75), $encoded, '%s: First line should be 25 bytes shorter than the others.');
 }
开发者ID:ningcaichen,项目名称:laravel-4.1-quick-start-cn,代码行数:15,代码来源:Rfc2231EncoderTest.php


示例8: testClonedStreamStillReferencesSameCache

 public function testClonedStreamStillReferencesSameCache()
 {
     $cache = $this->_createKeyCache();
     $this->_checking(Expectations::create()->one($cache)->setString($this->_nsKey, 'foo', 'a', Swift_KeyCache::MODE_APPEND)->one($cache)->setString($this->_nsKey, 'foo', 'b', Swift_KeyCache::MODE_APPEND)->one($cache)->setString('test', 'bar', 'x', Swift_KeyCache::MODE_APPEND));
     $stream = new Swift_KeyCache_SimpleKeyCacheInputStream();
     $stream->setKeyCache($cache);
     $stream->setNsKey($this->_nsKey);
     $stream->setItemKey('foo');
     $stream->write('a');
     $stream->write('b');
     $newStream = clone $stream;
     $newStream->setKeyCache($cache);
     $newStream->setNsKey('test');
     $newStream->setItemKey('bar');
     $newStream->write('x');
 }
开发者ID:mahersafadi,项目名称:joindin-api,代码行数:16,代码来源:SimpleKeyCacheInputStreamTest.php


示例9: testUnbindingStreamPreventsFurtherWrites

 public function testUnbindingStreamPreventsFurtherWrites()
 {
     $file = $this->_createFileStream($this->_testFile, true);
     $is1 = $this->_createMockInputStream();
     $is2 = $this->_createMockInputStream();
     $this->_checking(Expectations::create()->one($is1)->write('x')->one($is2)->write('x')->one($is1)->write('y'));
     $file->bind($is1);
     $file->bind($is2);
     $file->write('x');
     $file->unbind($is2);
     $file->write('y');
 }
开发者ID:mahersafadi,项目名称:joindin-api,代码行数:12,代码来源:FileByteStreamAcceptanceTest.php


示例10: testAddingListenerTwiceDoesNotReceiveEventTwice

 public function testAddingListenerTwiceDoesNotReceiveEventTwice()
 {
     $transport = $this->_stub('Swift_Transport');
     $evt = $this->_dispatcher->createTransportChangeEvent($transport);
     $listener = $this->_mock('Swift_Events_TransportChangeListener');
     $this->_dispatcher->bindEventListener($listener);
     $this->_dispatcher->bindEventListener($listener);
     $this->_checking(Expectations::create()->one($listener)->transportStarted($evt)->never($listener)->transportStarted($evt));
     $this->_dispatcher->dispatchEvent($evt, 'transportStarted');
 }
开发者ID:Nyaan,项目名称:meintagebuchonline,代码行数:10,代码来源:SimpleEventDispatcherTest.php


示例11: testMixinSetterWhichReturnValuesAreNotFluid

 public function testMixinSetterWhichReturnValuesAreNotFluid()
 {
     $buf = $this->_getBuffer();
     $smtp = $this->_getTransport($buf);
     $ext1 = $this->_mock('Swift_Transport_EsmtpHandlerMixin');
     $ext2 = $this->_mock('Swift_Transport_EsmtpHandler');
     $this->_checking(Expectations::create()->allowing($ext1)->getHandledKeyword()->returns('AUTH')->allowing($ext1)->exposeMixinMethods()->returns(array('setUsername', 'setPassword'))->one($ext1)->setUsername('mick')->returns('x')->one($ext1)->setPassword('pass')->returns('x')->allowing($ext2)->getHandledKeyword()->returns('STARTTLS')->ignoring($ext1)->ignoring($ext2));
     $this->_finishBuffer($buf);
     $smtp->setExtensionHandlers(array($ext1, $ext2));
     $this->assertEqual('x', $smtp->setUsername('mick'));
     $this->assertEqual('x', $smtp->setPassword('pass'));
 }
开发者ID:Nyaan,项目名称:meintagebuchonline,代码行数:12,代码来源:ExtensionSupportTest.php


示例12: _getFactory

 private function _getFactory($reader)
 {
     $factory = $this->_mock('Swift_CharacterReaderFactory');
     $this->_checking(Expectations::create()->allowing($factory)->getReaderFor('utf-8')->returns($reader));
     return $factory;
 }
开发者ID:ningcaichen,项目名称:laravel-4.1-quick-start-cn,代码行数:6,代码来源:ArrayCharacterStreamTest.php


示例13: testDataCanBeExportedToByteStream

 public function testDataCanBeExportedToByteStream()
 {
     //See acceptance test for more detail
     $is = $this->_createInputStream();
     $this->_checking(Expectations::create()->atLeast(1)->of($is)->write(any())->ignoring($is));
     $kcis = $this->_createKeyCacheInputStream(true);
     $cache = $this->_createCache($kcis);
     $cache->setString($this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE);
     $cache->exportToByteStream($this->_key1, 'foo', $is);
 }
开发者ID:mahersafadi,项目名称:joindin-api,代码行数:10,代码来源:ArrayKeyCacheTest.php


示例14: testFirstLineLengthCanBeDifferent

 public function testFirstLineLengthCanBeDifferent()
 {
     $input = str_repeat('a', 140);
     $charStream = $this->_createCharStream();
     $seq = $this->_mockery()->sequence('byte-sequence');
     $exps = Expectations::create();
     $exps->one($charStream)->flushContents();
     $exps->one($charStream)->importString($input);
     $output = '';
     for ($i = 0; $i < 140; ++$i) {
         $exps->one($charStream)->readBytes(optional())->inSequence($seq)->returns(array(ord('a')));
         if (53 == $i || 53 + 75 == $i) {
             $output .= "=\r\n";
         }
         $output .= 'a';
     }
     $exps->one($charStream)->readBytes(optional())->inSequence($seq)->returns(false);
     $this->_checking($exps);
     $encoder = new Swift_Encoder_QpEncoder($charStream);
     $this->assertEqual($output, $encoder->encodeString($input, 22), '%s: First line should start at offset 22 so can only have max length 54');
 }
开发者ID:guitarooman14,项目名称:hackazon,代码行数:21,代码来源:QpEncoderTest.php


示例15: testAuthenticationFailureSendRsetAndReturnFalse

 public function testAuthenticationFailureSendRsetAndReturnFalse()
 {
     $cram = $this->_getAuthenticator();
     $this->_checking(Expectations::create()->one($this->_agent)->executeCommand("AUTH CRAM-MD5\r\n", array(334))->returns('334 ' . base64_encode('<foo@bar>') . "\r\n")->one($this->_agent)->executeCommand(any(), array(235))->throws(new Swift_TransportException(""))->one($this->_agent)->executeCommand("RSET\r\n", array(250)));
     $this->assertFalse($cram->authenticate($this->_agent, 'jack', 'pass'), '%s: Authentication fails, so RSET should be sent');
 }
开发者ID:abouthalf,项目名称:archies-recipes,代码行数:6,代码来源:CramMd5AuthenticatorTest.php


示例16: _createFileStream

 protected function _createFileStream($path, $data, $stub = true)
 {
     $file = $this->_mock('Swift_FileStream');
     $pos = $this->_mockery()->states('position')->startsAs('at start');
     $this->_checking(Expectations::create()->ignoring($file)->getPath()->returns($path)->ignoring($file)->read(optional())->returns($data)->when($pos->isNot('at end'))->then($pos->is('at end'))->ignoring($file)->read(optional())->returns(false));
     if ($stub) {
         $this->_checking(Expectations::create()->ignoring($file));
     }
     return $file;
 }
开发者ID:Nyaan,项目名称:meintagebuchonline,代码行数:10,代码来源:AttachmentTest.php


示例17: testCanonicEncodeByteStreamGeneratesCorrectCrlf_5

 public function testCanonicEncodeByteStreamGeneratesCorrectCrlf_5()
 {
     $encoder = $this->_getEncoder('7bit', true);
     $os = $this->_createOutputByteStream();
     $is = $this->_createInputByteStream();
     $collection = new Swift_StreamCollector();
     $this->_checking(Expectations::create()->allowing($is)->write(any(), optional())->will($collection)->ignoring($is)->one($os)->read(optional())->returns('a')->one($os)->read(optional())->returns("\r\r")->one($os)->read(optional())->returns('b')->allowing($os)->read(optional())->returns(false)->ignoring($os));
     $encoder->encodeByteStream($os, $is);
     $this->assertEqual("a\r\n\r\nb", $collection->content);
 }
开发者ID:mahersafadi,项目名称:joindin-api,代码行数:10,代码来源:PlainContentEncoderTest.php


示例18: testEmbedReturnsValidCid

 public function testEmbedReturnsValidCid()
 {
     $child = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_RELATED, '', false);
     $this->_checking(Expectations::create()->ignoring($child)->getId()->returns('foo@bar')->ignoring($child));
     $message = $this->_createMessage($this->_createHeaderSet(), $this->_createEncoder(), $this->_createCache());
     $this->assertEqual('cid:foo@bar', $message->embed($child));
 }
开发者ID:guitarooman14,项目名称:hackazon,代码行数:7,代码来源:SimpleMessageTest.php


示例19: _createPart

 private function _createPart($type, $body, $id)
 {
     $part = $this->_mock('Swift_Mime_MimeEntity');
     $this->_checking(Expectations::create()->ignoring($part)->getContentType()->returns($type)->ignoring($part)->getBody()->returns($body)->ignoring($part)->getId()->returns($id));
     return $part;
 }
开发者ID:Fyflon,项目名称:MTA-XyzzyRP,代码行数:6,代码来源:DecoratorPluginTest.php


示例20: _createMockAuthenticator

 private function _createMockAuthenticator($type)
 {
     $authenticator = $this->_mock('Swift_Transport_Esmtp_Authenticator');
     $this->_checking(Expectations::create()->ignoring($authenticator)->getAuthKeyword()->returns($type));
     return $authenticator;
 }
开发者ID:ninjapenguin,项目名称:Kohana-Swift4-Module,代码行数:6,代码来源:AuthHandlerTest.php



注:本文中的Expectations类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ExplicitReadWriteModelPermissionsUtil类代码示例发布时间:2022-05-23
下一篇:
PHP ExerciseLib类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap