本文整理汇总了PHP中Phake::anyParameters方法的典型用法代码示例。如果您正苦于以下问题:PHP Phake::anyParameters方法的具体用法?PHP Phake::anyParameters怎么用?PHP Phake::anyParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phake
的用法示例。
在下文中一共展示了Phake::anyParameters方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseNormal
/**
* @test
*/
public function parseNormal()
{
\Phake::when($this->parser)->parse(\Phake::anyParameters())->thenReturn(null);
$path = __DIR__ . '/../fixtures/1';
$this->projectParser->parse($path);
\Phake::verify($this->parser, \Phake::times(3))->parse(\Phake::anyParameters());
}
示例2: createRedisClient
public function createRedisClient(array $parameters = array())
{
$mockedRedisClient = \Phake::mock('\\PSRedis\\Client');
\Phake::when($mockedRedisClient)->isMaster()->thenReturn(false);
\Phake::when($mockedRedisClient)->getMaster(\Phake::anyParameters())->thenReturn($mockedRedisClient);
return $mockedRedisClient;
}
示例3: callProtectedMusicAPI
protected function callProtectedMusicAPI($call_fn, $expected_url_extension, $expected_params = [], $sample_response = null)
{
if ($sample_response === null) {
$sample_response = ['foo' => 'bar'];
}
$generator = new Generator();
// set up the mock to check headers generated
$tokenly_api = Phake::partialMock('Tokenly\\APIClient\\TokenlyAPI', 'https://127.0.0.1/api/v1', $generator, 'MY_CLIENT_ID', 'MY_CLIENT_SECRET');
$called_vars = [];
Phake::when($tokenly_api)->callRequest(Phake::anyParameters())->thenReturnCallback(function ($url, $headers, $request_params, $method, $request_options) use($sample_response, &$called_vars) {
$called_vars = [];
$response = new Requests_Response();
$response->body = json_encode($sample_response);
$called_vars['headers'] = $headers;
$called_vars['url'] = $url;
$called_vars['params'] = $request_params;
return $response;
});
$music_api = new MusicAPI($tokenly_api);
// check API call
$result = $call_fn($music_api);
PHPUnit::assertEquals($sample_response, $result);
// check called URL
PHPUnit::assertEquals('https://127.0.0.1/api/v1/' . $expected_url_extension, $called_vars['url']);
// check headers
$headers_generated = $called_vars['headers'];
PHPUnit::assertNotEmpty($headers_generated);
$nonce = $headers_generated['X-TOKENLY-AUTH-NONCE'];
PHPUnit::assertGreaterThanOrEqual(time(), $nonce);
PHPUnit::assertEquals('MY_CLIENT_ID', $headers_generated['X-TOKENLY-AUTH-API-TOKEN']);
$expected_signature = $this->expectedSignature($nonce, 'https://127.0.0.1/api/v1/' . $expected_url_extension, $expected_params);
PHPUnit::assertEquals($expected_signature, $headers_generated['X-TOKENLY-AUTH-SIGNATURE']);
// return the called vars
return $called_vars;
}
示例4: parseMethodComment
/**
* @test
*/
public function parseMethodComment()
{
\Phake::when($this->annotationsParser)->parse(\Phake::anyParameters())->thenReturn([]);
$stmts = (include __DIR__ . '/../fixtures/1/Model/Product.php.method.cache');
$method = $this->parser->parse($stmts, $this->class);
$this->assertThat($method->comment, $this->equalTo('Sets updated datetimedetailed description here'));
}
示例5: 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());
}
示例6: parseClassComment
/**
* @test
*/
public function parseClassComment()
{
\Phake::when($this->annotationsParser)->parse(\Phake::anyParameters())->thenReturn([]);
$stmts = (include __DIR__ . '/../fixtures/1/Model/Product.php.class.cache');
$class = $this->parser->parse($stmts, '', '');
$this->assertThat($class->comment, $this->equalTo('商品エンティティ'));
}
示例7: testWork
public function testWork()
{
\Phake::when($this->scraper)->scrape(\Phake::anyParameters())->thenReturn(array(new Entity(), new Entity()));
$result = $this->target->work(null);
\Phake::verify($this->scraper)->scrape($this->definition);
$this->assertCount(2, $result);
}
示例8: should_convert_segment_to_string
/** @test */
public function should_convert_segment_to_string()
{
$segment = new Segment('XXX');
$segment->var = 'value';
$segmentMapping = new SegmentMapping('XXX');
$segmentMapping->addDataElement(1, new DataElementMapping(2345, true, DataElementType::A, 'var'));
$message = new Message();
$message->setReferenceNumber(34834);
$message->setIdentifier(["type" => 'TEST', "version" => 'S', "release" => '404', "controllingAgency" => 'PG']);
$message->addSegment($segment);
// $messageMapping = new MessageMapping();
// $messageMapping->setDefaults(["0065" => 'TEST', "0052" => 'S', "0054" => '404', "0051" => 'PG']);
// $messageMapping->addSegment(new MessageSegmentMapping('UNH', 1, true));
// $messageMapping->addSegment(new MessageSegmentMapping('XXX', 99, true));
// $messageMapping->addSegment(new MessageSegmentMapping('UNT', 1, true));
$interchange = new Interchange();
$interchange->setSyntax(["name" => 'UNOC', "version" => 3]);
$interchange->setSender(['id' => 'zenon']);
$interchange->setRecipient(['id' => 'stefan']);
$interchange->setTime(['date' => '20150101', 'time' => '1034']);
$interchange->setControlReference('17');
$interchange->setMessages([$message]);
$mappingLoader = \Phake::mock(MappingLoader::class);
\Phake::when($mappingLoader)->loadSegments(\Phake::anyParameters())->thenReturn(['XXX' => $segmentMapping]);
$encoder = new Encoder(new AnnotationPrinter(new AnnotationReader()), new SegmentPrinter(), $mappingLoader);
$result = $encoder->encode($interchange);
$this->assertEquals("UNB+UNOC:3+zenon+stefan+20150101:1034+17'UNH+34834+TEST:S:404:PG'XXX+value'UNT+1+34834'UNZ+1+17'", $result);
}
示例9: parseNormal
/**
* @test
*/
public function parseNormal()
{
\Phake::when($this->commentsParser)->parse(\Phake::anyParameters())->thenReturn(null);
$stmts = (include __DIR__ . '/../fixtures/1/Model/Product.php.property_base.cache');
$this->parser->parse($stmts, $this->property, $this->class);
\Phake::verify($this->commentsParser)->parse(\Phake::anyParameters());
}
示例10: setUp
protected function setUp()
{
parent::setUp();
Phake::when($this->facade)->is_user_logged_in()->thenReturn(true);
Phake::when($this->facade)->wp_get_current_user()->thenReturn($this->user);
Phake::when($this->wpdb)->get_var(Phake::anyParameters())->thenReturn('true');
}
开发者ID:ThemeSurgeon,项目名称:launchkey-wordpress,代码行数:7,代码来源:class-launchkey-wp-native-client-still-authenticated-heartbeat-test.php
示例11: setUp
protected function setUp()
{
Phake::initAnnotations($this);
Phake::when($this->wpdb)->get_var(Phake::anyParameters())->thenReturn('true');
$this->wpdb->usermeta = 'usermeta_table_name';
$this->user->ID = 'User ID';
$this->client = new LaunchKey_WP_SSO_Client($this->facade, $this->template, static::ENTITY_ID, $this->saml_response_service, $this->saml_request_service, $this->wpdb, static::LOGIN_URL, static::LOGOUT_URL, static::ERROR_URL, false);
}
开发者ID:aenglander,项目名称:launchkey-wordpress,代码行数:8,代码来源:class-launchkey-wp-sso-client-test-abstract.php
示例12: testExecuteNoResultNoParameter
public function testExecuteNoResultNoParameter()
{
\Phake::when($this->target)->getAffectedRows()->thenReturn(0);
\Phake::when($this->connection)->prepare('DROP TABLE')->thenReturn($this->statement);
$this->target->executeNoResult('DROP TABLE');
\Phake::verify($this->statement, \Phake::never())->bind_param(\Phake::anyParameters());
\Phake::verify($this->statement)->close();
}
示例13: testReadOkNothing
public function testReadOkNothing()
{
\Phake::when($this->connection)->prepare(\Phake::anyParameters())->thenReturn($this->statement);
\Phake::when($this->statement)->fetch()->thenReturn(false);
$this->assertSame('', $this->target->read('1234'));
\Phake::verify($this->statement)->bind_param('s', '1234');
\Phake::verify($this->statement)->close();
}
示例14: setUp
protected function setUp()
{
Phake::initAnnotations($this);
Phake::when($this->container)->generateId(Phake::anyParameters())->thenReturn(static::UNIQUE_ID);
SAML2_Compat_ContainerSingleton::setContainer($this->container);
$this->service = new LaunchKey_WP_SAML2_Request_Service(self::$key);
$this->service->load_saml_request(self::$request_data);
}
开发者ID:aenglander,项目名称:launchkey-wordpress,代码行数:8,代码来源:class-launchkey-wp-saml2-request-service-test.php
示例15: registerConsentFactory
/**
* Registers a factory which returns mocked consents
*/
protected function registerConsentFactory()
{
$this[self::CONSENT_FACTORY] = function (EngineBlock_Application_DiContainer $container) {
$consentFactoryMock = Phake::mock('EngineBlock_Corto_Model_Consent_Factory');
Phake::when($consentFactoryMock)->create(Phake::anyParameters())->thenReturn(Phake::mock('EngineBlock_Corto_Model_Consent'));
return $consentFactoryMock;
};
}