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


PHP Argument::is方法代码示例

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


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

示例1:

 function its_method_set_port_should_throw_an_exception_on_invalid_port_value()
 {
     $this->shouldThrow('\\Superdesk\\ContentApiSdk\\Exception\\InvalidArgumentException')->duringSetPort(Argument::is(null));
     $this->shouldThrow('\\Superdesk\\ContentApiSdk\\Exception\\InvalidArgumentException')->duringSetPort(Argument::type('string'));
     $this->shouldThrow('\\Superdesk\\ContentApiSdk\\Exception\\InvalidArgumentException')->duringSetPort(Argument::type('array'));
     $this->shouldThrow('\\Superdesk\\ContentApiSdk\\Exception\\InvalidArgumentException')->duringSetPort(Argument::type('object'));
 }
开发者ID:superdesk,项目名称:contentapi-sdk-php,代码行数:7,代码来源:RequestSpec.php

示例2: sets_RID_and_registers_inserted_document_with_UnitOfWork

    /**
     * @test
     */
    public function sets_RID_and_registers_inserted_document_with_UnitOfWork()
    {
        $c = new Contact();
        $oid = spl_object_hash($c);
        $uow = $this->prophesize(UnitOfWork::class);
        $uow->getDocumentInsertions()->willReturn([$oid => $c]);
        $uow->getDocumentChangeSet(Arg::is($c))->willReturn(['name' => ['old', 'new']]);
        $uow->getDocumentUpdates()->willReturn([]);
        $uow->getCollectionUpdates()->willReturn([]);
        $uow->getCollectionDeletions()->willReturn([]);
        $uow->getDocumentDeletions()->willReturn([]);
        $uow->getDocumentActualData(Arg::is($c))->willReturn([]);
        $uow->registerManaged($c, '#1:0', [])->shouldBeCalled();
        $uow->raisePostPersist(Arg::any(), $c)->shouldBeCalled();
        $res = json_decode(<<<JSON
{
    "result":[{
        "n0":"#1:0"
    }]
}
JSON
, true);
        $b = $this->prophesize(BindingInterface::class);
        $b->sqlBatch(Arg::any())->willReturn($res);
        $p = new SQLBatchPersister($this->metadataFactory, $b->reveal());
        $p->process($uow->reveal());
    }
开发者ID:Edencia,项目名称:orientdb-php-odm,代码行数:30,代码来源:SQLBatchPersisterWithEmbeddedDocumentTest.php

示例3: setupMockResponse

 protected function setupMockResponse(RequestInterface $request, $response)
 {
     // If a string is passed in, assume its a path to a HTTP representation
     if (is_string($response)) {
         $response = $this->getFixture($response);
     }
     $this->client->send(Argument::is($request))->shouldBeCalled()->willReturn($response);
 }
开发者ID:boxrice007,项目名称:openstack,代码行数:8,代码来源:TestCase.php

示例4: getTask

 /**
  * @return \oat\oatbox\task\Task
  */
 private function getTask()
 {
     $invocableReport = new \common_report_Report(\common_report_Report::TYPE_INFO, 'Invocable Called');
     $taskInvocableProphecy = $this->prophet->prophesize('oat\\oatbox\\action\\Action');
     $taskInvocableProphecy->__invoke(Argument::is(['foo', 'bar']))->shouldBeCalledTimes(1)->willReturn($invocableReport);
     $taskProphecy = $this->prophet->prophesize('oat\\oatbox\\task\\Task');
     $taskProphecy->getId()->shouldBeCalled()->willReturn('testTask');
     $taskProphecy->getInvocable()->shouldBeCalled()->willReturn($taskInvocableProphecy->reveal());
     $taskProphecy->getParameters()->shouldBeCalled()->willReturn(['foo', 'bar']);
     return $taskProphecy->reveal();
 }
开发者ID:oat-sa,项目名称:generis,代码行数:14,代码来源:TaskRunnerTest.php

示例5: it_be_add_tow_user_to_onw_day

 public function it_be_add_tow_user_to_onw_day(EntityManagerInterface $entityManager, DayRepository $dayRepository, UserRepository $userRepository, DayAndUserRelationship $dayAndUserRelationship, Day $day, User $user)
 {
     $entityManager->getRepository(Argument::is("TrolleyAgendaBundle:Day"))->willReturn($dayRepository)->shouldBeCalled();
     $entityManager->getRepository(Argument::is("TrolleyAgendaBundle:User"))->willReturn($userRepository)->shouldBeCalled();
     $dayRepository->find('31')->willReturn($day)->shouldBeCalled();
     $userRepository->find('20')->willReturn($user)->shouldBeCalled();
     $userRepository->find('errorID')->shouldNotBeCalled();
     $dayAndUserRelationship->addUserToDay(Argument::is($user->getWrappedObject()), Argument::is($day->getWrappedObject()))->shouldBeCalled();
     $formular = ['dayid_31' => [20, 'errorID']];
     $this->processForm($formular);
 }
开发者ID:TumTum,项目名称:TrolleyAgenda,代码行数:11,代码来源:BulksUsersToDaysSpec.php

示例6: setUpEvents

 public function setUpEvents()
 {
     $events = $this->prophesize('Zend\\EventManager\\EventManagerInterface');
     $events->attach(Argument::type('ZF\\MvcAuth\\MvcRouteListener'));
     $events->attach(MvcAuthEvent::EVENT_AUTHENTICATION, Argument::type('ZF\\MvcAuth\\Authentication\\DefaultAuthenticationListener'));
     $events->attach(MvcAuthEvent::EVENT_AUTHENTICATION_POST, Argument::type('ZF\\MvcAuth\\Authentication\\DefaultAuthenticationPostListener'));
     $events->attach(MvcAuthEvent::EVENT_AUTHORIZATION, Argument::type('ZF\\MvcAuth\\Authorization\\DefaultResourceResolverListener'), 1000);
     $events->attach(MvcAuthEvent::EVENT_AUTHORIZATION, Argument::type('ZF\\MvcAuth\\Authorization\\DefaultAuthorizationListener'));
     $events->attach(MvcAuthEvent::EVENT_AUTHORIZATION_POST, Argument::type('ZF\\MvcAuth\\Authorization\\DefaultAuthorizationPostListener'));
     $events->attach(MvcAuthEvent::EVENT_AUTHENTICATION_POST, Argument::is([$this->module, 'onAuthenticationPost']), -1);
     return $events;
 }
开发者ID:nuxwin,项目名称:zf-mvc-auth,代码行数:12,代码来源:ModuleTest.php

示例7: before

    /**
     * @before
     */
    public function before()
    {
        /** @var BindingInterface|ObjectProphecy $binding */
        $binding = $this->prophesize(BindingInterface::class);
        $binding->getDatabaseName()->willReturn("ODM");
        $data = <<<JSON
{
    "classes": [
        {"name":"LinkedContact", "clusters":[1]},
        {"name":"LinkedEmailAddress", "clusters":[2]},
        {"name":"LinkedPhone", "clusters":[3]}
    ]
}
JSON;
        $binding->getDatabaseInfo()->willReturn(json_decode($data, true));
        $rawResult = '{
            "@type": "d", "@rid": "#2:1", "@version": 1, "@class": "LinkedEmailAddress",
            "type": "work",
            "email": "syd@gmail.com",
            "contact": "#1:1"
        }';
        $binding->getDocument(Arg::is("#2:1"), Arg::any())->willReturn(json_decode($rawResult, true));
        $rawResult = '[{
            "@type": "d", "@rid": "#3:1", "@version": 1, "@class": "LinkedPhone",
            "type": "work",
            "phoneNumber": "4805551920",
            "primary": true
        },{
            "@type": "d", "@rid": "#3:2", "@version": 1, "@class": "LinkedPhone",
            "type": "home",
            "phoneNumber": "5552094878",
            "primary": false
        }]';
        $binding->query(Arg::any())->willReturn(json_decode($rawResult, true));
        $this->manager = $this->createDocumentManagerWithBinding($binding->reveal(), [], ['test/Doctrine/ODM/OrientDB/Tests/Document/Stub']);
        $this->uow = $this->manager->getUnitOfWork();
        $this->metadataFactory = $this->manager->getMetadataFactory();
    }
开发者ID:Edencia,项目名称:orientdb-php-odm,代码行数:41,代码来源:DynamicHydratorTest.php

示例8: testWithdrawCancelNotification

 /**
  * @cover ::handleHiPayNotification
  * @throws \HiPay\Wallet\Mirakl\Exception\ChecksumFailedException
  * @throws \HiPay\Wallet\Mirakl\Exception\IllegalNotificationOperationException
  */
 public function testWithdrawCancelNotification()
 {
     $xml = $this->readFile("withdrawCanceled.xml");
     $operation = new Operation(2000, new DateTime(), "000001", rand());
     $operation->setStatus(new Status(Status::WITHDRAW_REQUESTED));
     $this->operationManager->findByWithdrawalId(Argument::type("string"))->willReturn($operation)->shouldBeCalled();
     $this->operationManager->save(Argument::is($operation))->shouldBeCalled();
     $this->setEventAssertion(array("withdraw", "canceled"), "Withdraw");
     $this->notificationHandler->handleHiPayNotification($xml);
     $this->assertEquals(Status::WITHDRAW_CANCELED, $operation->getStatus());
 }
开发者ID:hipay,项目名称:hipay-wallet-cashout-mirakl-library,代码行数:16,代码来源:HandlerTest.php

示例9: testBankInfoValidate

 /**
  * @cover ::handleBankInfo
  */
 public function testBankInfoValidate()
 {
     $vendors = Mirakl::getVendor();
     $miraklData = reset($vendors);
     $vendor = $this->getVendorInstance($miraklData);
     $miraklData = array($vendor->getMiraklId() => $miraklData);
     $this->hipay->bankInfosStatus($this->vendorArgument)->willReturn(BankInfoStatus::VALIDATED)->shouldBeCalled();
     $this->hipay->bankInfosCheck(Argument::is($vendor))->will(function () use($miraklData, $vendor) {
         $bankInfo = new BankInfo();
         return $bankInfo->setMiraklData($miraklData[$vendor->getMiraklId()]);
     })->shouldBeCalled();
     $this->vendorProcessor->handleBankInfo(array($vendor), $miraklData);
 }
开发者ID:hipay,项目名称:hipay-wallet-cashout-mirakl-library,代码行数:16,代码来源:ProcessorTest.php

示例10: testWithdrawUnvalidatedBankInfo

 /**
  * @cover ::withdraw
  * @group withdraw
  */
 public function testWithdrawUnvalidatedBankInfo()
 {
     $amount = floatval(rand());
     $vendor = new Vendor("test@test.com", rand(), rand());
     $operation = new Operation($amount, new DateTime(), "000001", $vendor->getHipayId());
     $operation->setStatus(new Status(Status::TRANSFER_SUCCESS));
     /** @var VendorInterface $vendorArgument */
     $vendorArgument = Argument::is($vendor);
     $this->vendorManager->findByMiraklId(Argument::is($operation->getMiraklId()))->willReturn($vendor);
     $this->hipay->isAvailable(Argument::containingString("@"), Argument::any())->willReturn(false);
     $this->hipay->isIdentified(Argument::containingString("@"))->willReturn(true);
     $this->hipay->bankInfosStatus($vendorArgument)->willReturn(BankInfo::BLANK)->shouldBeCalled();
     $this->hipay->getBalance($vendorArgument)->willReturn($amount + 1);
     $this->hipay->withdraw(Argument::cetera())->shouldNotBeCalled();
     $this->setExpectedException("\\HiPay\\Wallet\\Mirakl\\Exception\\UnconfirmedBankAccountException");
     $this->cashoutProcessor->withdraw($operation);
 }
开发者ID:hipay,项目名称:hipay-wallet-cashout-mirakl-library,代码行数:21,代码来源:ProcessorTest.php

示例11: test_true_is_returned_when_token_validation_returns_error

 public function test_true_is_returned_when_token_validation_returns_error()
 {
     $request = $this->setupMockRequest('HEAD', 'auth/tokens', [], ['X-Subject-Token' => 'tokenId']);
     $this->client->send(Argument::is($request))->shouldBeCalled()->willThrow(new BadResponseError());
     $this->assertFalse($this->service->validateToken('tokenId'));
 }
开发者ID:boxrice007,项目名称:openstack,代码行数:6,代码来源:ServiceTest.php

示例12:

 function it_is_initializable()
 {
     $this->beConstructedWith(Argument::is('url'), Argument::is(8087), Argument::is('user'), Argument::is('password'));
     $this->shouldHaveType(WowzaConnectionCount::class);
 }
开发者ID:topix-hackademy,项目名称:laravel-wowza-restapi,代码行数:5,代码来源:WowzaConnectionCountSpec.php

示例13: test_it_checks_nonexistent_group_role

 public function test_it_checks_nonexistent_group_role()
 {
     $request = $this->setupMockRequest('HEAD', 'domains/DOMAIN_ID/groups/GROUP_ID/roles/ROLE_ID');
     $this->client->send(Argument::is($request))->shouldBeCalled()->willThrow(new BadResponseError());
     $this->assertFalse($this->domain->checkGroupRole(['groupId' => 'GROUP_ID', 'roleId' => 'ROLE_ID']));
 }
开发者ID:boxrice007,项目名称:openstack,代码行数:6,代码来源:DomainTest.php

示例14: setOrderTestProphecy

 /**
  * @param $file
  * @param bool|true $withOperatorOperation
  */
 public function setOrderTestProphecy($file, $withOperatorOperation = true)
 {
     $this->mirakl->getTransactions(Argument::type('integer'), Argument::is(null), Argument::is(null), Argument::is(null), Argument::is(null), Argument::is(null), Argument::type("string"), Argument::cetera())->will(function ($args) use($file) {
         $shopId = $args[0];
         $paymentVoucher = $args[6];
         $array = Mirakl::getOrderTransactions($shopId, $paymentVoucher, $file);
         return $array;
     })->shouldBeCalled();
     $this->transactionValidator->isValid(Argument::type('array'))->willReturn(true)->shouldBeCalled();
     $this->operationManager->create(Argument::type('float'), Argument::type('DateTime'), Argument::type('string'), Argument::type('int'))->will(function ($args) {
         list($amount, $cycleDate, $paymentVoucher, $miraklId) = $args;
         return new Operation($amount, $cycleDate, $paymentVoucher, $miraklId);
     })->shouldBeCalled();
     if ($withOperatorOperation) {
         $this->operationManager->create(Argument::type('float'), Argument::type('DateTime'), Argument::type('string'), Argument::is(null))->will(function ($args) {
             list($amount, $cycleDate, $paymentVoucher, $miraklId) = $args;
             return new Operation($amount, $cycleDate, $paymentVoucher, $miraklId);
         })->shouldBeCalled();
     }
 }
开发者ID:hipay,项目名称:hipay-wallet-cashout-mirakl-library,代码行数:24,代码来源:InitializerTest.php

示例15: test_it_checks_nonexistent_memberships

 public function test_it_checks_nonexistent_memberships()
 {
     $request = $this->setupMockRequest('HEAD', 'groups/GROUP_ID/users/USER_ID');
     $this->client->send(Argument::is($request))->shouldBeCalled()->willThrow(new BadResponseError());
     $this->assertFalse($this->group->checkMembership(['userId' => 'USER_ID']));
 }
开发者ID:boxrice007,项目名称:openstack,代码行数:6,代码来源:GroupTest.php


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