當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Phake::equalTo方法代碼示例

本文整理匯總了PHP中Phake::equalTo方法的典型用法代碼示例。如果您正苦於以下問題:PHP Phake::equalTo方法的具體用法?PHP Phake::equalTo怎麽用?PHP Phake::equalTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Phake的用法示例。


在下文中一共展示了Phake::equalTo方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testConfigureCustomAggregateFactory

 public function testConfigureCustomAggregateFactory()
 {
     $this->fixture->registerAggregateFactory($this->mockAggregateFactory);
     $this->fixture->registerAnnotatedCommandHandler(new MyCommandHandler($this->fixture->getRepository(), $this->fixture->getEventBus()));
     $this->fixture->given([new MyEvent("id1", 1)])->when(new TestCommand("id1"));
     \Phake::verify($this->mockAggregateFactory, \Phake::atLeast(1))->createAggregate(\Phake::equalTo("id1"), \Phake::anyParameters());
 }
開發者ID:peanohan,項目名稱:GovernorFramework,代碼行數:7,代碼來源:GenericFixtureTest.php

示例2: testStubWithEqualsMatcher

 /**
  * Tests using an equalTo argument matcher with a method stub
  */
 public function testStubWithEqualsMatcher()
 {
     $mock = Phake::mock('PhakeTest_MockedClass');
     Phake::when($mock)->fooWithArgument(Phake::equalTo('bar'))->thenReturn(42);
     $this->assertEquals(42, $mock->fooWithArgument('bar'));
     $this->assertNull($mock->fooWithArgument('test'));
 }
開發者ID:kore,項目名稱:Phake,代碼行數:10,代碼來源:PhakeTest.php

示例3: testFindsByCompoundPrimaryKeyAndSequence

 public function testFindsByCompoundPrimaryKeyAndSequence()
 {
     $bp = new Blueprint($this->machinist, 'test_table', array('column1' => "hello", 'column2' => "dumb"));
     $expected = array('key1' => 8, 'key2' => 12, 'column1' => "hello", 'column2' => "dumb");
     Phake::when($this->store)->insert(Phake::equalTo("test_table"), Phake::equalTo(array('column1' => "hello", 'column2' => "dumb", "key1" => 8)))->thenReturn(12);
     Phake::when($this->store)->primaryKey("test_table")->thenReturn(array('key1', 'key2'));
     Phake::when($this->store)->find(Phake::equalTo("test_table"), Phake::equalTo(array('key1' => 8, 'key2' => 12)))->thenReturn(array($expected));
     $actual = $bp->make(array('key1' => 8, 'key2' => 12));
     $this->assertEquals($actual->toArray(), $expected);
 }
開發者ID:derptest,項目名稱:phpmachinist,代碼行數:10,代碼來源:BlueprintTest.php

示例4: testMatcherSetsNextMatcherInChain

 public function testMatcherSetsNextMatcherInChain()
 {
     $matcher1 = Phake::mock('Phake_Matchers_IChainableArgumentMatcher');
     $matcher2 = Phake::mock('Phake_Matchers_IChainableArgumentMatcher');
     /* @var $newMatcher Phake_Matchers_IChainableArgumentMatcher */
     $this->factory->createMatcher($matcher2);
     $this->factory->createMatcher($matcher1, $matcher2);
     $this->assertNull($matcher2->getNextMatcher());
     Phake::verify($matcher1)->setNextMatcher(Phake::equalTo($matcher2));
 }
開發者ID:eric-seekas,項目名稱:Phake,代碼行數:10,代碼來源:FactoryTest.php

示例5: testTransactionBoundUnitOfWorkLifecycle_Rollback

 public function testTransactionBoundUnitOfWorkLifecycle_Rollback()
 {
     $mockListener = \Phake::mock(UnitOfWorkListenerInterface::class);
     $mockTransactionManager = \Phake::mock(TransactionManagerInterface::class);
     \Phake::when($mockTransactionManager)->startTransaction()->thenReturn(new \stdClass());
     $uow = DefaultUnitOfWork::startAndGet($mockTransactionManager);
     $uow->registerListener($mockListener);
     \Phake::verify($mockTransactionManager)->startTransaction();
     \Phake::verifyNoInteraction($mockListener);
     $uow->rollback();
     \Phake::inOrder(\Phake::verify($mockTransactionManager)->rollbackTransaction(\Phake::anyParameters()), \Phake::verify($mockListener)->onRollback(\Phake::anyParameters()), \Phake::verify($mockListener)->onCleanup(\Phake::equalTo($uow)));
 }
開發者ID:fcm,項目名稱:GovernorFramework,代碼行數:12,代碼來源:DefaultUnitOfWorkTest.php

示例6: test_register_session_index_writes_data_to_the_table

 public function test_register_session_index_writes_data_to_the_table()
 {
     $start = time();
     $this->service->register_session_index();
     $end = time();
     $expected = "INSERT INTO prefix_launchkey_sso_sessions VALUES (%s, %s) ON DUPLICATE KEY UPDATE seen = %s";
     Phake::inOrder(Phake::verify($this->wpdb)->prepare($expected, Phake::equalTo("id-b4373c87a6f18f97862c931744fd799f"), Phake::capture($insert_date_string), Phake::capture($update_date_string)), Phake::verify($this->wpdb)->query(static::PREPARED_STARTEMENT));
     $this->assertEquals($insert_date_string, $update_date_string, "Insert and update date strings were expected to be the same but were not");
     $this->assertRegExp('/[12][0-9]{3}-[0-9]{2}-[0-9]{2} [0-2][0-9]:[0-5][0-9]:[0-5][0-9]/', $insert_date_string, "Date strings are not in MYSQL date format");
     $sql_time = strtotime($insert_date_string);
     $this->assertGreaterThanOrEqual($start, $sql_time, sprintf("Date string of %s is not on or after recorded start time of %s", $insert_date_string, date('Y-m-d H:i:s', $start)));
     $this->assertLessThanOrEqual($end, $sql_time, sprintf("Date string of %s is not on or after recorded start time of %s", $insert_date_string, date('Y-m-d H:i:s', $end)));
 }
開發者ID:aenglander,項目名稱:launchkey-wordpress,代碼行數:13,代碼來源:class-launchkey-wp-saml2-response-service-test.php

示例7: testSendMessageWithPublisherAck_NoActiveUnitOfWork

 public function testSendMessageWithPublisherAck_NoActiveUnitOfWork()
 {
     $this->testSubject->setTransactional(false);
     $this->testSubject->setWaitForPublisherAck(true);
     $channel = \Phake::mock(AMQPChannel::class);
     \Phake::when($channel)->wait_for_pending_acks()->thenReturn(null);
     \Phake::when($this->connection)->channel()->thenReturn($channel);
     $message = new GenericEventMessage(new Payload("Message"));
     \Phake::when($this->serializer)->serialize(\Phake::equalTo($message->getPayload()))->thenReturn(new SimpleSerializedObject(json_encode($message->getPayload()), new SimpleSerializedType(Payload::class)));
     \Phake::when($this->serializer)->serialize(\Phake::equalTo($message->getMetaData()))->thenReturn(new SimpleSerializedObject(json_encode(array('metadata' => array())), new SimpleSerializedType(MetaData::class)));
     $this->testSubject->publish(array($message));
     \Phake::verify($channel)->confirm_select();
     \Phake::verify($channel)->basic_publish(\Phake::anyParameters());
     \Phake::verify($channel)->wait_for_pending_acks(\Phake::anyParameters());
 }
開發者ID:fcm,項目名稱:GovernorFramework,代碼行數:15,代碼來源:AmqpTerminalTest.php


注:本文中的Phake::equalTo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。