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


PHP Mockery::any方法代码示例

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


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

示例1: testCompile

 public function testCompile()
 {
     $this->_mockLogger->shouldReceive('error')->once()->with('Failed to inspect <code>bogus class</code>: <code>Class bogus class does not exist</code>');
     $this->_mockLogger->shouldReceive('error')->once()->with('Failed to inspect <code>Hello</code>: <code>Class Hello does not exist</code>');
     $this->_mockLogger->shouldReceive('error')->once()->with('Failed to inspect <code>There</code>: <code>Class There does not exist</code>');
     $this->_mockLogger->shouldReceive('error')->once()->with('(Add-on <code>1</code> of <code>2</code>: <code>mock add-on 1</code>) Failed to load <code>bogus class</code> as a container extension: <code>Class bogus class does not exist</code>');
     $this->_mockLogger->shouldReceive('error')->once()->with('(Add-on <code>2</code> of <code>2</code>: <code>mock add-on 2</code>) Failed to load <code>Hello</code> as a container extension: <code>Class Hello does not exist</code>');
     $this->_mockLogger->shouldReceive('error')->once()->with('(Add-on <code>2</code> of <code>2</code>: <code>mock add-on 2</code>) Failed to load <code>There</code> as a container extension: <code>Class There does not exist</code>');
     $this->_mockLogger->shouldReceive('error')->once()->with('Failed to load <code>no such class</code> as a compiler pass: <code>Class no such class does not exist</code>');
     $mockAddon1 = $this->mock(tubepress_api_contrib_AddonInterface::_);
     $mockAddon2 = $this->mock(tubepress_api_contrib_AddonInterface::_);
     $mockAddon1->shouldReceive('getName')->andReturn('mock add-on 1');
     $mockAddon2->shouldReceive('getName')->andReturn('mock add-on 2');
     $mockAddon1IocContainerExtensions = array('FakeExtension', 'bogus class');
     $mockAddon2IocContainerExtensions = array('Hello', 'There');
     $mockAddon2IocCompilerPasses = array('FakeCompilerPass' => 5, 'no such class' => 4);
     $mockAddon1->shouldReceive('getExtensionClassNames')->once()->andReturn($mockAddon1IocContainerExtensions);
     $mockAddon1->shouldReceive('getMapOfCompilerPassClassNamesToPriorities')->once()->andReturn(array());
     $mockAddon2->shouldReceive('getExtensionClassNames')->once()->andReturn($mockAddon2IocContainerExtensions);
     $mockAddon2->shouldReceive('getMapOfCompilerPassClassNamesToPriorities')->once()->andReturn($mockAddon2IocCompilerPasses);
     $mockAddons = array($mockAddon1, $mockAddon2);
     $this->_mockIocContainer->shouldReceive('compile')->once();
     $this->_mockIocContainer->shouldReceive('addCompilerPass')->once()->with(Mockery::any('FakeCompilerPass'));
     $this->_mockIocContainer->shouldReceive('registerExtension')->once()->with(Mockery::any('FakeExtension'));
     $this->_sut->compile($this->_mockIocContainer, $mockAddons);
     $this->assertTrue(true);
 }
开发者ID:tubepress,项目名称:tubepress,代码行数:27,代码来源:CompilerTest.php

示例2: it_uses_query_builder_to_filter_choices

    /** @test */
    public function it_uses_query_builder_to_filter_choices()
    {
        $mdl = new DummyModel();
        $options = [
            'class' => 'DummyModel',
            'property' => 'short_name',
            'query_builder' => function (DummyModel $model) {
                return $model->getData()->filter(function($val) {
                    return $val['id'] > 1;
                });
            }
        ];

        $this->fieldExpetations('select', Mockery::any());
        $this->fieldExpetations('choice', Mockery::any());

        $choice = new EntityType('entity_choice', 'entity', $this->plainForm, $options);
        $choice->render();

        $expected = [
            2 => 'Fr',
            3 => 'Rs'
        ];

        $this->assertEquals($expected, $choice->getOption('choices'));
    }
开发者ID:zgao4,项目名称:laravel-form-builder,代码行数:27,代码来源:EntityTypeTest.php

示例3: friendship_is_cancelled

 /** @test */
 public function friendship_is_cancelled()
 {
     $this->sender->befriend($this->recipient);
     $this->recipient->acceptFriendRequest($this->sender);
     Event::shouldReceive('fire')->once()->withArgs(['friendships.cancelled', Mockery::any()]);
     $this->recipient->unfriend($this->sender);
 }
开发者ID:hootlex,项目名称:laravel-friendships,代码行数:8,代码来源:FriendshipsEventsTest.php

示例4: testGetURIWithIndex

 public function testGetURIWithIndex()
 {
     $uri = '/testIndex/_analyze';
     $mockTransport = m::mock('\\Elasticsearch\\Transport')->shouldReceive('performRequest')->once()->with('GET', $uri, array(), m::any())->getMock();
     $action = new Analyze($mockTransport);
     $action->setIndex('testIndex')->performRequest();
 }
开发者ID:diglin,项目名称:smile-magento-elasticsearch,代码行数:7,代码来源:AnalyzeTest.php

示例5: testShouldRunSniffer

 public function testShouldRunSniffer()
 {
     /*
     |------------------------------------------------------------
     | Set
     |------------------------------------------------------------
     */
     $command = m::mock('LeroyMerlin\\LaraSniffer\\SniffCommand[getPHPSnifferInstance]');
     $command->shouldAllowMockingProtectedMethods();
     $command->app = m::mock('LaravelApp');
     $command->config = m::mock('Config');
     $phpcs = m::mock("PHP_CodeSniffer_CLI");
     $options = ['standard' => "PSRX", 'files' => "path/to/files", 'ignored' => array('*blade.php'), 'extensions' => array("php")];
     /*
     |------------------------------------------------------------
     | Expectation
     |------------------------------------------------------------
     */
     $command->shouldReceive('getPHPSnifferInstance')->once()->andReturn($phpcs);
     $phpcs->shouldReceive('checkRequirements')->once();
     $command->config->shouldReceive('get')->with('larasniffer::standard', m::any())->andReturn('PSRX');
     $command->config->shouldReceive('get')->with('larasniffer::files', m::any())->andReturn('path/to/files');
     $command->config->shouldReceive('get')->with('larasniffer::ignored', m::any())->andReturn(array('*blade.php'));
     $phpcs->shouldReceive('process')->with($options)->once()->andReturnUsing(function () {
         echo 'Something';
         return 1;
     });
     /*
     |------------------------------------------------------------
     | Assertion
     |------------------------------------------------------------
     */
     $this->assertEquals('Something', $command->runSniffer());
 }
开发者ID:hilltool,项目名称:larasniffer,代码行数:34,代码来源:SniffCommandTest.php

示例6: testUpdate

 public function testUpdate()
 {
     $this->transport->shouldReceive('performRequest')->once()->withArgs(['PATCH', 'subscriptions/10/', [], ['event_name' => 'order_unit_new', 'callback_url' => 'http://localhost/v2', 'fallback_email' => 'root@localhost.com', 'is_active' => false], \Mockery::any()])->andReturn(['status' => 204]);
     $namespace = new SubscriptionsNamespace($this->transport);
     $result = $namespace->update(10, 'order_unit_new', 'http://localhost/v2', 'root@localhost.com', false);
     $this->assertTrue($result);
 }
开发者ID:hitmeister,项目名称:api-sdk-php,代码行数:7,代码来源:SubscriptionsNamespaceTest.php

示例7: testGetValuesFromTo

 public function testGetValuesFromTo()
 {
     $expectedValues = [60 => 1.0];
     $this->_query->shouldReceive('run')->with(m::any(), ['dataset' => 'mock-dataset', 'from' => new DateTimeImmutable(date('c', 60)), 'to' => new DateTimeImmutable(date('c', 120))])->andReturn([(object) ['value' => 1, 'period' => 60]]);
     $returnedValues = $this->_range->getValues(60, 120);
     $this->assertSame($returnedValues, $expectedValues);
 }
开发者ID:mothership-ec,项目名称:cog-mothership-cp,代码行数:7,代码来源:DateRangeTest.php

示例8: test_install

 public function test_install()
 {
     /** === Test Data === */
     /** === Setup Mocks === */
     // $setup->startSetup();
     $this->mSetup->shouldReceive('startSetup')->once();
     // $demPackage = $this->_toolDem->readDemPackage($pathToFile, $pathToNode);
     $mDemPackage = $this->_mock(DataObject::class);
     $this->mToolDem->shouldReceive('readDemPackage')->once()->withArgs([\Mockery::any(), '/dBEAR/package/Praxigento/package/Bonus/package/Base'])->andReturn($mDemPackage);
     // $demEntity = $demPackage->getData('package/Type/entity/Asset');
     $mDemPackage->shouldReceive('getData');
     //
     // $this->_toolDem->createEntity($entityAlias, $demEntity);
     //
     $this->mToolDem->shouldReceive('createEntity')->withArgs([TypeCalc::ENTITY_NAME, \Mockery::any()]);
     $this->mToolDem->shouldReceive('createEntity')->withArgs([Period::ENTITY_NAME, \Mockery::any()]);
     $this->mToolDem->shouldReceive('createEntity')->withArgs([Calculation::ENTITY_NAME, \Mockery::any()]);
     $this->mToolDem->shouldReceive('createEntity')->withArgs([Compress::ENTITY_NAME, \Mockery::any()]);
     $this->mToolDem->shouldReceive('createEntity')->withArgs([Level::ENTITY_NAME, \Mockery::any()]);
     $this->mToolDem->shouldReceive('createEntity')->withArgs([Rank::ENTITY_NAME, \Mockery::any()]);
     $this->mToolDem->shouldReceive('createEntity')->withArgs([CfgGeneration::ENTITY_NAME, \Mockery::any()]);
     $this->mToolDem->shouldReceive('createEntity')->withArgs([LogCustomers::ENTITY_NAME, \Mockery::any()]);
     $this->mToolDem->shouldReceive('createEntity')->withArgs([LogOpers::ENTITY_NAME, \Mockery::any()]);
     $this->mToolDem->shouldReceive('createEntity')->withArgs([LogRank::ENTITY_NAME, \Mockery::any()]);
     $this->mToolDem->shouldReceive('createEntity')->withArgs([LogSales::ENTITY_NAME, \Mockery::any()]);
     // $setup->endSetup();
     $this->mSetup->shouldReceive('endSetup')->once();
     /** === Call and asserts  === */
     $this->obj->install($this->mSetup, $this->mContext);
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_bonus_base,代码行数:30,代码来源:InstallSchema_Test.php

示例9: testProcessMessage

 public function testProcessMessage()
 {
     $amqpChannel = $this->getMockBuilder('AMQPChannel')->disableOriginalConstructor()->getMock();
     $amqpChannel->expects($this->once())->method('getPrefetchCount')->willReturn(3);
     $message = $this->getMockBuilder('AMQPEnvelope')->disableOriginalConstructor()->getMock();
     $amqpQueue = $this->getMockBuilder('AMQPQueue')->disableOriginalConstructor()->getMock();
     $amqpExchange = $this->getMockBuilder('AMQPExchange')->disableOriginalConstructor()->getMock();
     $eventResponse = $this->getMock('Zend\\EventManager\\ResponseCollection');
     $eventManager = m::mock('Zend\\EventManager\\EventManager');
     $eventManager->shouldReceive('setIdentifiers');
     $message->expects($this->once())->method('getDeliveryTag')->willReturn('delivery-tag');
     $message->expects($this->once())->method('getCorrelationId')->willReturn('correlation-id');
     $message->expects($this->once())->method('getReplyTo')->willReturn('reply-to');
     $amqpQueue->expects($this->once())->method('getChannel')->willReturn($amqpChannel);
     $amqpQueue->expects($this->any())->method('get')->willReturn($message);
     $reponse = json_encode(array('success' => true, 'result' => 'response-result'));
     $amqpExchange->expects($this->once())->method('publish')->with($this->equalTo($reponse), $this->equalTo('reply-to'), $this->equalTo(AMQP_NOPARAM), $this->callback(function ($param) {
         return is_array($param);
     }));
     $rpcServer = new RpcServer($amqpQueue, 1, 1 * 1000 * 500);
     $rpcServer->setEventManager($eventManager);
     $rpcServer->setExchange($amqpExchange);
     $eventResponse->expects($this->atLeast(1))->method('last')->willReturn('response-result');
     $eventManager->shouldReceive('trigger')->once()->with('delivery', $rpcServer, ['message' => $message, 'queue' => $amqpQueue])->andReturn($eventResponse);
     $eventManager->shouldReceive('trigger')->once()->with('ack', $rpcServer, m::any());
     $amqpQueue->expects($this->once())->method('ack');
     $rpcServer->consume(1);
 }
开发者ID:vitapublic,项目名称:HumusAmqpModule,代码行数:28,代码来源:RpcServerTest.php

示例10: testRun

 /**
  * Tests the <code>run()</code> method.
  *
  * @covers Braincrafted\Mq\Server::__construct()
  * @covers Braincrafted\Mq\Server::run()
  */
 public function testRun()
 {
     $this->socket->shouldReceive('on')->with('connection', m::any())->once();
     $this->socket->shouldReceive('listen')->with(4000)->once();
     $this->loop->shouldReceive('run')->withNoArgs()->once();
     $this->server->run('php consumer.php', 4000);
 }
开发者ID:braincrafted,项目名称:mq,代码行数:13,代码来源:ServerTest.php

示例11: testUpdate

 public function testUpdate()
 {
     $this->transport->shouldReceive('performRequest')->once()->withArgs(['PATCH', 'product-data/1231231231232/', [], ['category' => ['alpin-skier']], \Mockery::any()])->andReturn(['status' => 204]);
     $namespace = new ProductDataNamespace($this->transport);
     $result = $namespace->update("1231231231232", ProductDataTransfer::make(['category' => ['alpin-skier']]));
     $this->assertTrue($result);
 }
开发者ID:hitmeister,项目名称:api-sdk-php,代码行数:7,代码来源:ProductDataNamespaceTest.php

示例12: testGetViewReturnsDefaultViewWithNoView

 public function testGetViewReturnsDefaultViewWithNoView()
 {
     $template = new Template();
     View::shouldReceive('exists')->with(\Mockery::any())->andReturn(false);
     View::shouldReceive('make')->with('boomcms::templates.default');
     $template->getView();
 }
开发者ID:robbytaylor,项目名称:boom-core,代码行数:7,代码来源:TemplateTest.php

示例13: it_creates_choice_as_radio_buttons

    /** @test */
    public function it_creates_choice_as_radio_buttons()
    {
        $options = [
            'attr' => ['class' => 'choice-class-something'],
            'choices' => [1 => 'yes', 2 => 'no'],
            'selected' => 'no',
            'expanded' => true
        ];

        $this->fieldExpetations('radio', Mockery::any());

        $this->fieldExpetations('radio', Mockery::any());

        $this->fieldExpetations('choice', Mockery::any());

        $choice = new ChoiceType('some_choice', 'choice', $this->plainForm, $options);

        $choice->render();

        $this->assertEquals(2, count($choice->getChildren()));

        $this->assertInstanceOf(
            'Kris\LaravelFormBuilder\Fields\CheckableType',
            $choice->getChild(1)
        );

        $this->assertEquals('no', $choice->getOption('selected'));

        $this->assertContainsOnlyInstancesOf('Kris\LaravelFormBuilder\Fields\CheckableType', $choice->getChildren());
    }
开发者ID:zgao4,项目名称:laravel-form-builder,代码行数:31,代码来源:ChoiceTypeTest.php

示例14: test_install

 public function test_install()
 {
     /** === Test Data === */
     /** === Setup Mocks === */
     // $setup->startSetup();
     $this->mSetup->shouldReceive('startSetup')->once();
     // $demPackage = $this->_toolDem->readDemPackage($pathToFile, $pathToNode);
     $mDemPackage = $this->_mock(DataObject::class);
     $this->mToolDem->shouldReceive('readDemPackage')->once()->withArgs([\Mockery::any(), '/dBEAR/package/Praxigento/package/Odoo'])->andReturn($mDemPackage);
     // $demEntity = $demPackage->getData('package/Type/entity/Asset');
     $mDemPackage->shouldReceive('getData');
     //
     // $this->_toolDem->createEntity($entityAlias, $demEntity);
     //
     $this->mToolDem->shouldReceive('createEntity')->withArgs([Category::ENTITY_NAME, \Mockery::any()]);
     $this->mToolDem->shouldReceive('createEntity')->withArgs([Customer::ENTITY_NAME, \Mockery::any()]);
     $this->mToolDem->shouldReceive('createEntity')->withArgs([Lot::ENTITY_NAME, \Mockery::any()]);
     $this->mToolDem->shouldReceive('createEntity')->withArgs([Product::ENTITY_NAME, \Mockery::any()]);
     $this->mToolDem->shouldReceive('createEntity')->withArgs([SaleOrder::ENTITY_NAME, \Mockery::any()]);
     $this->mToolDem->shouldReceive('createEntity')->withArgs([Warehouse::ENTITY_NAME, \Mockery::any()]);
     // $setup->endSetup();
     $this->mSetup->shouldReceive('endSetup')->once();
     /** === Call and asserts  === */
     $this->obj->install($this->mSetup, $this->mContext);
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_odoo,代码行数:25,代码来源:InstallSchema_Test.php

示例15: testBuildView

 public function testBuildView()
 {
     $optionsBoth = array('attr' => array('input_group' => array('button_prepend' => array('name' => 'prepend', 'type' => 'submit', 'options' => array()), 'button_append' => array('name' => 'append', 'type' => 'submit', 'options' => array()))));
     $buttonPrepend = m::mock('Symfony\\Component\\Form\\Button');
     $buttonPrepend->shouldReceive('createView')->andReturn('prepend');
     $buttonAppend = m::mock('Symfony\\Component\\Form\\Button');
     $buttonAppend->shouldReceive('createView')->andReturn('append');
     $buttonBuilderPrepend = m::mock('Symfony\\Component\\Form\\ButtonBuilder');
     $buttonBuilderPrepend->shouldReceive('getForm')->andReturn($buttonPrepend);
     $buttonBuilderAppend = m::mock('Symfony\\Component\\Form\\ButtonBuilder');
     $buttonBuilderAppend->shouldReceive('getForm')->andReturn($buttonAppend);
     $builder = m::mock('Symfony\\Component\\Form\\FormBuilderInterface');
     $builder->shouldReceive('create')->with('prepend', m::any(), m::any())->andReturn($buttonBuilderPrepend);
     $builder->shouldReceive('create')->with('append', m::any(), m::any())->andReturn($buttonBuilderAppend);
     $builder->shouldReceive('getName')->andReturn('input_name');
     $this->extension->buildForm($builder, $optionsBoth);
     $view = new FormView();
     $type = m::mock('Symfony\\Component\\Form\\FormInterface');
     $type->shouldReceive('getName')->andReturn('input_name');
     $this->extension->buildView($view, $type, array());
     $this->assertArrayHasKey('input_group_button_prepend', $view->vars);
     $this->assertArrayHasKey('input_group_button_append', $view->vars);
     $this->assertEquals('prepend', $view->vars['input_group_button_prepend']);
     $this->assertEquals('append', $view->vars['input_group_button_append']);
 }
开发者ID:saxulum,项目名称:saxulum-bootstrap-provider,代码行数:25,代码来源:InputGroupButtonExtensionTest.php


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