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


PHP Mockery::mock方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     $this->subjectConfirmation = m::mock('SAML2\\XML\\saml\\SubjectConfirmation');
     $this->subjectConfirmationData = m::mock('SAML2\\XML\\saml\\SubjectConfirmationData');
     $this->subjectConfirmation->SubjectConfirmationData = $this->subjectConfirmationData;
 }
开发者ID:SysBind,项目名称:saml2,代码行数:7,代码来源:SubjectConfirmationRecipientMathchesTest.php

示例2: setUp

 public function setUp()
 {
     $this->mockProxy = M::mock('Webservice\\TransactionDbProxy');
     $this->handler = new BugHandler();
     $this->handler->setLanguage("de");
     $this->handler->setDbProxy($this->mockProxy);
 }
开发者ID:CloCkWeRX,项目名称:kort,代码行数:7,代码来源:TestBugHandler.php

示例3: testAddingRouteActuallyAddsPhalcoreRoute

 public function testAddingRouteActuallyAddsPhalcoreRoute()
 {
     $route = $this->instance->add('/foo', ['controller' => 'foo', 'action' => 'bar']);
     $this->assertInstanceOf('Phalcore\\Mvc\\Router\\Route', $route);
     $this->assertContains($route, $this->instance->getRoutes());
     $this->assertNotContains(m::mock('Phalcore\\Mvc\\Router\\Route'), $this->instance->getRoutes());
 }
开发者ID:halfbakedsneed,项目名称:phalcore,代码行数:7,代码来源:RouterTest.php

示例4: ampersandsAcceptableCharacterForTalks

 /**
  * Verify that talks with ampersands and other characters in them can
  * be created and then edited properly
  *
  * @test
  */
 public function ampersandsAcceptableCharacterForTalks()
 {
     $controller = new OpenCFP\Http\Controller\TalkController();
     $controller->setApplication($this->app);
     // Create a test double for SwiftMailer
     $swiftmailer = m::mock('StdClass');
     $swiftmailer->shouldReceive('send')->andReturn(true);
     $this->app['mailer'] = $swiftmailer;
     // Get our request object to return expected data
     $talk_data = ['title' => 'Test Title With Ampersand', 'description' => "The title should contain this & that", 'type' => 'regular', 'level' => 'entry', 'category' => 'other', 'desired' => 0, 'slides' => '', 'other' => '', 'sponsor' => '', 'user_id' => $this->app['sentry']->getUser()->getId()];
     $this->setPost($talk_data);
     /**
      * If the talk was successfully created, a success value is placed
      * into the session flash area for display
      */
     $create_response = $controller->processCreateAction($this->req);
     $create_flash = $this->app['session']->get('flash');
     $this->assertEquals($create_flash['type'], 'success');
     // Now, edit the results and update them
     $talk_data['id'] = 1;
     $talk_data['description'] = "The title should contain this & that & this other thing";
     $talk_data['title'] = "Test Title With Ampersand & More Things";
     $this->setPost($talk_data);
     $update_response = $controller->updateAction($this->req, $this->app);
     $update_flash = $this->app['session']->get('flash');
     $this->assertEquals($update_flash['type'], 'success');
 }
开发者ID:hilltool,项目名称:opencfp,代码行数:33,代码来源:TalkControllerTest.php

示例5: testGetIncludedColumn

 public function testGetIncludedColumn()
 {
     $model = m::mock(array('getTable' => 'table', 'method' => m::mock(array('getRelated' => m::mock(array('getKeyName' => 'fk'))))));
     $this->config->shouldReceive('getDataModel')->once()->andReturn($model);
     $this->column->shouldReceive('getOption')->once()->andReturn('method');
     $this->assertEquals($this->column->getIncludedColumn(), array('fk' => 'table.fk'));
 }
开发者ID:hifone,项目名称:dashboard,代码行数:7,代码来源:BelongsToManyTest.php

示例6: getFilesystem

 /**
  * @return mixed Really a Filesystem|MockInterface but coding standards get confused
  */
 private function getFilesystem()
 {
     $fileSystem = m::mock(Filesystem::class);
     $fileSystem->shouldReceive('getAdapter')->andReturn(m::mock(AdapterInterface::class));
     $fileSystem->shouldReceive('getConfig')->andReturn(null);
     return $fileSystem;
 }
开发者ID:graze,项目名称:data-file,代码行数:10,代码来源:FileNodeTest.php

示例7: testHandleThrowPass

 public function testHandleThrowPass()
 {
     $middleware = new AuthoriseRole();
     $this->assertTrue($middleware->handle(Mockery::mock('\\Illuminate\\Http\\Request'), function () {
         return true;
     }, 'su'));
 }
开发者ID:paybreak,项目名称:basket,代码行数:7,代码来源:AuthoriseRoleTest.php

示例8: setup

 /**
  * Setup method
  * @return void
  */
 public function setup()
 {
     $targetClass = DefinedTargetClass::factory('Mockery\\Test\\Generator\\StringManipulation\\Pass\\MagicDummy');
     $this->pass = new MagicMethodTypeHintsPass();
     $this->mockedConfiguration = m::mock('Mockery\\Generator\\MockConfiguration');
     $this->mockedConfiguration->shouldReceive('getTargetClass')->andReturn($targetClass)->byDefault();
 }
开发者ID:mockery,项目名称:mockery,代码行数:11,代码来源:MagicMethodTypeHintsPassTest.php

示例9: testPushCommand

 /**
  * Integration Test.
  */
 public function testPushCommand()
 {
     $configuration_file = ['bypass' => false, 'default' => 'AwsS3', 'url' => 'https://s3.amazonaws.com', 'threshold' => 10, 'providers' => ['aws' => ['s3' => ['region' => 'us-standard', 'version' => 'latest', 'buckets' => ['my-bucket-name' => '*'], 'acl' => 'public-read', 'cloudfront' => ['use' => false, 'cdn_url' => ''], 'metadata' => [], 'expires' => gmdate('D, d M Y H:i:s T', strtotime('+5 years')), 'cache-control' => 'max-age=2628000', 'version' => '']]], 'include' => ['directories' => [__DIR__], 'extensions' => [], 'patterns' => []], 'exclude' => ['directories' => [], 'files' => [], 'extensions' => [], 'patterns' => [], 'hidden' => true]];
     $m_consol = M::mock('Symfony\\Component\\Console\\Output\\ConsoleOutput');
     $m_consol->shouldReceive('writeln')->atLeast(1);
     $finder = new \Vinelab\Cdn\Finder($m_consol);
     $asset = new \Vinelab\Cdn\Asset();
     $provider_factory = new \Vinelab\Cdn\ProviderFactory();
     $m_config = M::mock('Illuminate\\Config\\Repository');
     $m_config->shouldReceive('get')->with('cdn')->once()->andReturn($configuration_file);
     $helper = new \Vinelab\Cdn\CdnHelper($m_config);
     $m_console = M::mock('Symfony\\Component\\Console\\Output\\ConsoleOutput');
     $m_console->shouldReceive('writeln')->atLeast(2);
     $m_validator = M::mock('Vinelab\\Cdn\\Validators\\Contracts\\ProviderValidatorInterface');
     $m_validator->shouldReceive('validate');
     $m_helper = M::mock('Vinelab\\Cdn\\CdnHelper');
     $m_spl_file = M::mock('Symfony\\Component\\Finder\\SplFileInfo');
     $m_spl_file->shouldReceive('getPathname')->andReturn('vinelab/cdn/tests/Vinelab/Cdn/AwsS3ProviderTest.php');
     $m_spl_file->shouldReceive('getRealPath')->andReturn(__DIR__ . '/AwsS3ProviderTest.php');
     // partial mock
     $p_aws_s3_provider = M::mock('\\Vinelab\\Cdn\\Providers\\AwsS3Provider[connect]', array($m_console, $m_validator, $m_helper));
     $m_s3 = M::mock('Aws\\S3\\S3Client')->shouldIgnoreMissing();
     $m_s3->shouldReceive('factory')->andReturn('Aws\\S3\\S3Client');
     $m_command = M::mock('Aws\\Command');
     $m_s3->shouldReceive('getCommand')->andReturn($m_command);
     $m_s3->shouldReceive('execute');
     $p_aws_s3_provider->setS3Client($m_s3);
     $p_aws_s3_provider->shouldReceive('connect')->andReturn(true);
     \Illuminate\Support\Facades\App::shouldReceive('make')->once()->andReturn($p_aws_s3_provider);
     $cdn = new \Vinelab\Cdn\Cdn($finder, $asset, $provider_factory, $helper);
     $result = $cdn->push();
     assertEquals($result, true);
 }
开发者ID:filipegar,项目名称:cdn,代码行数:36,代码来源:CdnTest.php

示例10: setUp

 public function setUp()
 {
     DI::reset();
     DI::setDefault($di = new DI());
     $this->instance = m::mock('Phalcore\\Di\\Facade');
     $di->setShared('foo', m::mock('foo'));
 }
开发者ID:halfbakedsneed,项目名称:phalcore,代码行数:7,代码来源:FacadeTest.php

示例11: testGetCustomersInvalidCustomer

 public function testGetCustomersInvalidCustomer()
 {
     $this->setExpectedException('\\DomainException');
     $jsonProvider = \Mockery::mock('\\KieranBamforth\\CustomerInviter\\CustomerProvider\\JsonProvider[isCustomerValid]', [$this->json]);
     $jsonProvider->shouldReceive('isCustomerValid')->andReturn(false);
     $jsonProvider->getCustomers();
 }
开发者ID:kieran-bamforth,项目名称:customer-inviter,代码行数:7,代码来源:JsonProviderTest.php

示例12: testRotate

 public function testRotate()
 {
     $newProfile = $this->getFaker()->word;
     $encryptor = \Mockery::mock('Giftcards\\Encryption\\Encryptor');
     $observer = \Mockery::mock('Giftcards\\Encryption\\CipherText\\Rotator\\ObserverInterface');
     $fields = $this->fields;
     $fields[] = $this->idField;
     $faker = $this->getFaker();
     $row1 = array_combine($fields, array_map(function () use($faker) {
         return $faker->unique()->word;
     }, $fields));
     $row2 = array_combine($fields, array_map(function () use($faker) {
         return $faker->unique()->word;
     }, $fields));
     $row3 = array_combine($fields, array_map(function () use($faker) {
         return $faker->unique()->word;
     }, $fields));
     $this->pdo->shouldReceive('prepare')->once()->with(sprintf('SELECT %s FROM %s', implode(', ', $fields), $this->table))->andReturn(\Mockery::mock()->shouldReceive('execute')->once()->getMock()->shouldReceive('fetch')->times(4)->with(\PDO::FETCH_ASSOC)->andReturn($row1, $row2, $row3, false)->getMock());
     $observer->shouldReceive('rotating')->once()->ordered()->with($row1[$this->idField])->getMock()->shouldReceive('rotated')->once()->ordered()->with($row1[$this->idField])->getMock()->shouldReceive('rotating')->once()->ordered()->with($row2[$this->idField])->getMock()->shouldReceive('rotated')->once()->ordered()->with($row2[$this->idField])->getMock()->shouldReceive('rotating')->once()->ordered()->with($row3[$this->idField])->getMock()->shouldReceive('rotated')->once()->ordered()->with($row3[$this->idField])->getMock();
     foreach (array($row1, $row2, $row3) as $row) {
         $parameters = array();
         $setFields = array();
         foreach ($row as $field => $value) {
             if ($field == $this->idField) {
                 continue;
             }
             $encryptor->shouldReceive('decrypt')->once()->with($value)->andReturn($decrypted = $this->getFaker()->unique()->word)->getMock()->shouldReceive('encrypt')->once()->with($decrypted, $newProfile)->andReturn($parameters[] = $this->getFaker()->unique()->word)->getMock();
             $setFields[] = sprintf('%s = ?', $field);
         }
         $parameters[] = $row[$this->idField];
         $this->pdo->shouldReceive('prepare')->once()->with(sprintf('UPDATE %s SET %s WHERE %s = ?', $this->table, implode(',', $setFields), $this->idField))->andReturn(\Mockery::mock()->shouldReceive('execute')->once()->with($parameters)->getMock());
     }
     $this->rotator->rotate($observer, $encryptor, $newProfile);
 }
开发者ID:SaveYa,项目名称:Encryption,代码行数:34,代码来源:DatabaseTableRotatorTest.php

示例13: setUp

 protected function setUp()
 {
     $this->outputInterface = new InMemoryOutputInterface();
     $this->preCommitConfig = new InMemoryHookConfig();
     $this->codeSnifferHandler = \Mockery::mock('PhpGitHooks\\Infrastructure\\CodeSniffer\\CodeSnifferHandler');
     $this->checkCodeStyleCodeSnifferPreCommitExecuter = new CheckCodeStyleCodeSnifferPreCommitExecuter($this->preCommitConfig, $this->codeSnifferHandler);
 }
开发者ID:raphaelcarles,项目名称:php-git-hooks,代码行数:7,代码来源:CheckCodeStyleCodeSnifferPreCommitExecuterTest.php

示例14: testBoot

 public function testBoot()
 {
     $this->app['orlex.controller.dirs'] = [$path = '/sample/path/to/controllers'];
     $this->app['orlex.route.compiler'] = m::mock('Orlex\\AnnotationManager\\Compiler');
     $this->app['orlex.route.compiler']->shouldReceive('compile')->once()->with($path)->andReturnNull();
     $this->provider->boot($this->app);
 }
开发者ID:nix5longhorn,项目名称:orlex,代码行数:7,代码来源:ServiceProviderTest.php

示例15: testValidSegmentsWithIndex

 public function testValidSegmentsWithIndex()
 {
     $body['docs'] = '1';
     $mockTransport = m::mock('\\Elasticsearch\\Transport')->shouldReceive('performRequest')->once()->with('PUT', '/testIndex/_settings', array(), array('docs' => 1))->getMock();
     $action = new Put($mockTransport);
     $action->setBody($body)->setIndex('testIndex')->performRequest();
 }
开发者ID:diglin,项目名称:smile-magento-elasticsearch,代码行数:7,代码来源:PutTest.php


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