本文整理匯總了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());
}
示例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'));
}
示例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);
}
示例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));
}
示例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)));
}
示例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());
}