当前位置: 首页>>代码示例>>PHP>>正文


PHP Mock::GeneratePartial方法代码示例

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


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

示例1: mockUpload

 function mockUpload($methods = array())
 {
     if (!is_array($methods)) {
         $methods = (array) $methods;
     }
     if (empty($methods)) {
         $methods = array('handleUploadedFile', 'unlink', '_getMimeType');
     }
     $mockName = $this->currentTestMethod . '_MockUploadBehavior';
     Mock::GeneratePartial('UploadBehavior', $mockName, $methods);
     $this->MockUpload = new $mockName();
     $this->MockUpload->setup($this->TestUpload, $this->TestUpload->actsAs['Upload.Upload']);
     $this->TestUpload->Behaviors->Upload = $this->MockUpload;
 }
开发者ID:aichelman,项目名称:StudyUp,代码行数:14,代码来源:upload.test.php

示例2: dirname

Swift_ClassLoader::load("Swift_Events_SendListener");
Swift_ClassLoader::load("Swift_Events_BeforeCommandListener");
Swift_ClassLoader::load("Swift_Events_CommandListener");
Swift_ClassLoader::load("Swift_Events_ResponseListener");
Swift_ClassLoader::load("Swift_Events_ConnectListener");
Swift_ClassLoader::load("Swift_Events_DisconnectListener");
Swift_ClassLoader::load("Swift_Plugin_AntiFlood");
Swift_ClassLoader::load("Swift_Plugin_BandwidthMonitor");
Swift_ClassLoader::load("Swift_Plugin_Throttler");
Swift_ClassLoader::load("Swift_Plugin_VerboseSending");
Swift_ClassLoader::load("Swift_Plugin_ConnectionRotator");
Swift_ClassLoader::load("Swift_Plugin_Decorator");
Swift_ClassLoader::load("Swift_Message_Headers");
Swift_ClassLoader::load("Swift_CacheFactory");
Swift_ClassLoader::load("Swift_Log_DefaultLog");
Swift_ClassLoader::load("Swift_Message_Encoder");
Swift_ClassLoader::load("Swift_Cache_JointOutputStream");
require_once TestConfiguration::SWIFT_LIBRARY_PATH . "/Swift/Authenticator/@PopB4Smtp.php";
Swift_ClassLoader::load("Swift_Authenticator_PopB4Smtp_Pop3Connection");
require_once dirname(__FILE__) . "/AbstractTestWithSend.php";
require_once dirname(__FILE__) . "/AbstractTestOfCache.php";
require_once dirname(__FILE__) . "/AbstractTestOfAuthenticator.php";
require_once dirname(__FILE__) . "/stubs/MimeExtension.php";
require_once dirname(__FILE__) . "/stubs/DummyConnection.php";
Mock::Generate("DummyConnection", "FullMockConnection");
Mock::Generate("Swift_Connection_Rotator", "MockRotatorConnection");
Mock::Generate("Swift_Message", "MockMessage");
Mock::Generate("Swift_Events_SendListener", "MockSendListener");
Mock::Generate("Swift_Connection_SMTP", "MockSMTPConnection");
Mock::GeneratePartial("Swift_Connection_SMTP", "MockSMTPConnectionAuth", array("read", "write", "isAlive", "start", "stop"));
Mock::Generate("Swift_Message_Headers", "MockHeaders");
开发者ID:Esleelkartea,项目名称:legedia-ESLE,代码行数:31,代码来源:common.php

示例3: array

<?php

/**
 * SwiftMailer Unit Test For the AntiFlood plugin.
 * @package Swift
 * @subpackage Tests
 * @author Chris Corbyn <chris@w3style.co.uk>
 */
Mock::GeneratePartial("Swift_Plugin_AntiFlood", "MockAntiFloodPlugin", array("wait"));
/**
 * SwiftMailer Unit Test For the AntiFlood plugin.
 * @package Swift
 * @subpackage Tests
 * @author Chris Corbyn <chris@w3style.co.uk>
 */
class TestOfAntiFloodPlugin extends AbstractTestWithSend
{
    /**
     * Tests that the connection is actually dropped when it's told to.
     */
    public function testDisconnectIsInvokedAsManyTimesAsNeeded()
    {
        $conn = $this->getWorkingMockConnection(20, null, 5);
        $conn->expectCallCount("stop", 4);
        $conn->expectCallCount("start", 5);
        $swift = new Swift($conn);
        $swift->attachPlugin(new Swift_Plugin_AntiFlood(5), "antiflood");
        for ($i = 0; $i < 20; $i++) {
            $swift->send(new Swift_Message("foo", "bar"), new Swift_Address("foo@bar.com"), new Swift_Address("foo@bar.com"));
        }
        $conn = $this->getWorkingMockConnection(20, null, 15);
开发者ID:Esleelkartea,项目名称:legedia-ESLE,代码行数:31,代码来源:TestOfAntiFloodPlugin.php

示例4: array

<?php

/**
 * Swift Mailer Unit Test for the Swift_Authenticator Interface.
 * @package Swift
 * @subpackage Tests
 * @author Chris Corbyn <chris@w3style.co.uk>
 */
Mock::Generate("Swift_Authenticator", "MockAuthenticator");
Mock::GeneratePartial("Swift_Connection_SMTP", "PartialSmtpConnection", array("read"));
/**
 * Swift Mailer Unit Test for the Swift_Authenticator Interface.
 * @package Swift
 * @subpackage Tests
 * @author Chris Corbyn <chris@w3style.co.uk>
 */
class TestOfAuthenticator extends UnitTestCase
{
    /**
     * Checks that the interface is actually invoked when needed.
     */
    public function testAuthenticatorIsInvokedIfSMTPUsernameAndPasswordSet()
    {
        try {
            $auth = new MockAuthenticator();
            $auth->setReturnValue("getAuthExtensionName", "FOO");
            $auth->expectOnce("isAuthenticated", array("foo", "bar", "*"));
            $smtp = new PartialSmtpConnection();
            $smtp->setExtension("AUTH", array("FOO"));
            $smtp->setUsername("foo");
            $smtp->setPassword("bar");
开发者ID:Esleelkartea,项目名称:legedia-ESLE,代码行数:31,代码来源:TestOfAuthenticator.php

示例5: array

<?php

if (!class_exists("PartialSmtpConnection2")) {
    Mock::GeneratePartial("Swift_Connection_SMTP", "PartialSmtpConnection2", array("read", "write", "start", "stop"));
}
Mock::GeneratePartial("Swift_Authenticator_PopB4Smtp_Pop3Connection", "MockPop3Connection", array("start", "stop", "read", "write"));
class TestOfPopB4SmtpAuthenticator extends UnitTestCase
{
    public function testSmtpConnectionIsClosedBeforeAnythingIsDone()
    {
        $pop3conn = new MockPop3Connection();
        $pop3conn->setReturnValue("read", "+OK foo");
        $auth = new Swift_Authenticator_PopB4Smtp($pop3conn);
        $conn = new PartialSmtpConnection2();
        $conn->attachAuthenticator($auth);
        $conn->setUsername("foo");
        $conn->setPassword("bar");
        $conn->setReturnValueAt(0, "read", "220 Hello ESMTP foo");
        $conn->setReturnValueAt(3, "read", "220 Hello ESMTP foo");
        $conn->setReturnValueAt(2, "read", "221 bye");
        $conn->setReturnValue("read", "250 Ok");
        $conn->expectMinimumCallCount("write", 2);
        $conn->expectAt(1, "write", array("QUIT", "*"));
        $conn->expectAtLeastOnce("stop");
        $swift = new Swift($conn, "xxx");
    }
    public function testAuthenticationPassesWithSuccessfulPop3Coversation()
    {
        $pop3conn = new MockPop3Connection();
        $pop3conn->setReturnValue("read", "+OK xxx");
        $pop3conn->expectAt(0, "write", array("USER foo"));
开发者ID:Esleelkartea,项目名称:legedia-ESLE,代码行数:31,代码来源:TestOfPopB4SmtpAuthenticator.php

示例6: array

<?php

if (!class_exists("FullMockConnection")) {
    Mock::Generate("DummyConnection", "FullMockConnection");
}
if (!class_exists("MockBaseConnection")) {
    Mock::GeneratePartial("DummyConnection", "MockBaseConnection", array("start", "stop", "read", "write"));
}
Mock::GeneratePartial("Swift_Message", "Message_RecipientsMocked", array("setTo", "setCc", "setBcc", "setFrom", "setReplyTo"));
Mock::GeneratePartial("Swift_Message", "Message_IdMocked", array("generateId"));
Mock::GeneratePartial("Swift_Message", "Message_EncodingMocked", array("setEncoding", "getEncoding"));
Mock::GeneratePartial("Swift_Log_DefaultLog", "MockLogger", array("add"));
class TestOfSwiftCore extends UnitTestCase
{
    public function setUp()
    {
        $log = new Swift_Log_DefaultLog();
        Swift_LogContainer::setLog($log);
    }
    public function testConnectionIsInvokedAtInstantiation()
    {
        $conn = new FullMockConnection();
        $conn->expectOnce("start");
        $swift = new Swift($conn, false, Swift::NO_HANDSHAKE);
    }
    public function testConnectionIsNotStartedIfNO_STARTFlagIsSet()
    {
        $conn = new FullMockConnection();
        $conn->expectNever("start");
        $swift = new Swift($conn, null, Swift::NO_START);
    }
开发者ID:Esleelkartea,项目名称:legedia-ESLE,代码行数:31,代码来源:TestOfSwiftCore.php

示例7: array

<?php

Mock::GeneratePartial("Swift_Connection_Sendmail", "PartialSendmailConnection", array("pipeIn", "pipeOut", "start", "stop"));
class TestOfSendmailConnection extends UnitTestCase
{
    public function testRunningIn_bs_ModeWritesAllSMTPCommands()
    {
        $sendmail = new PartialSendmailConnection();
        $sendmail->setReturnValueAt(0, "pipeOut", "220 xxx Hello");
        $sendmail->setReturnValueAt(1, "pipeOut", "250 Blah blah");
        $sendmail->setReturnValueAt(2, "pipeOut", "250 Ok");
        $sendmail->setReturnValueAt(3, "pipeOut", "250 Ok");
        $sendmail->setReturnValueAt(4, "pipeOut", "354 Go ahead");
        $sendmail->setReturnValueAt(5, "pipeOut", "250 Ok");
        $sendmail->expectAt(0, "pipeIn", array("HELO xxx", "*"));
        $sendmail->expectAt(1, "pipeIn", array("MAIL FROM: <zip@button.name>", "*"));
        $sendmail->expectAt(2, "pipeIn", array("RCPT TO: <foo@bar.tld>", "*"));
        $sendmail->expectAt(3, "pipeIn", array("DATA", "*"));
        $sendmail->expectAt(4, "pipeIn", array("*", "*"));
        $sendmail->setFlags("bs");
        $swift = new Swift($sendmail, "xxx");
        $message = new Swift_Message("subject", "body");
        $swift->send($message, new Swift_Address("foo@bar.tld"), new Swift_Address("zip@button.name"));
    }
    public function testRunningIn_t_ModeOnlyWritesMessageData()
    {
        //Dropped due to issues with Bcc handling and (correct) unreliability with mailers such as Exim
        // There are arguments online regarding this topic if you Google for 'sendmail "-t option" bcc recipients'
        // The code still exists in the Sendmail class, but I will not be supporting it's usage.
        /*$sendmail = new PartialSendmailConnection();
          $sendmail->expectOnce("pipeIn");
开发者ID:Esleelkartea,项目名称:legedia-ESLE,代码行数:31,代码来源:TestOfSendmailConnection.php


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