本文整理匯總了PHP中Prophecy\Argument::Any方法的典型用法代碼示例。如果您正苦於以下問題:PHP Argument::Any方法的具體用法?PHP Argument::Any怎麽用?PHP Argument::Any使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Prophecy\Argument
的用法示例。
在下文中一共展示了Argument::Any方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testShowThingsUp
public function testShowThingsUp()
{
$strategy = $this->prophesize("Bench\\IterationStrategy");
$strategy->getIterateCount(Argument::Any(), Argument::Any())->willReturn(10);
$b = new B("test", $strategy->reveal());
$printer = new PrintResult($b);
$this->assertRegExp("/test[ ]*\\d+[ ]*\\d+\\.\\d+ (ms|us|s){1}\\/op/i", (string) $printer);
}
示例2: it_should_execute_the_action_and_before_steps_for_methods
public function it_should_execute_the_action_and_before_steps_for_methods(ContainerInterface $container, HookReader $reader, Request $request, Response $response, Index $controller)
{
$container->get("Corley\\Demo\\Controller\\Index")->willReturn($controller);
$reader->getMethodAnnotationsFor(Argument::Any(), "index", Before::class)->willReturn([(object) ["targetClass" => "Corley\\Demo\\Controller\\Index", "targetMethod" => "far"]]);
$reader->getMethodAnnotationsFor(Argument::Any(), Argument::Any(), Argument::Any())->willReturn([]);
$reader->getClassAnnotationsFor(Argument::Any(), Argument::Any())->willReturn([]);
$controller->index($request, $response, Argument::Any())->shouldBeCalledTimes(1);
$controller->far($request, $response, Argument::Any())->shouldBeCalledTimes(1);
$matched = ["controller" => "Corley\\Demo\\Controller\\Index", "action" => "index"];
$this->execute($request, $response, $matched);
}
示例3: foreach
function it_gets_available_updates($client)
{
$fakeResponse = '{"_items":{"core":[{"version":"0.2.1","changelog":["commit1"]},{"version":"0.2.0"}]}}';
$client->call(Argument::Any(), Argument::Type('array'))->willReturn($fakeResponse);
$result = $this->getAvailableUpdates();
$result->shouldHaveCount(1);
$result->shouldBeArray();
foreach ($result['core'] as $package) {
$package->shouldHaveType('SWP\\UpdaterBundle\\Model\\UpdatePackage');
}
}
示例4: testRunBenchmarks
public function testRunBenchmarks()
{
$strategy = $this->prophesize("Bench\\IterationStrategy");
$strategy->getIterateCount(Argument::Any(), Argument::Any())->willReturn(10);
$extractor = $this->prophesize("Bench\\MethodExtractor");
$extractor->getCallables()->willReturn([["test", function () {
}]]);
$output = $this->prophesize('Symfony\\Component\\Console\\Output\\OutputInterface');
$output->writeln(Argument::Any())->shouldBeCalledTimes(1);
$sut = new BenchRunner($extractor->reveal(), $strategy->reveal(), $output->reveal());
$sut->runBenchmarks(new PrintResult());
}
示例5:
function it_creates_pending_version($versionFactory, ProductInterface $product, Version $pending)
{
$product->getId()->willReturn(1);
$versionFactory->create(Argument::Any(), 1, 'baz', null)->willReturn($pending);
$pending->getChangeset()->willReturn($pending);
$pending->setChangeset([])->willReturn($pending);
$pending->getAuthor()->willReturn('baz');
$pending->isPending()->willReturn(true);
$version = $this->createPendingVersion($product, 'baz', []);
$version->shouldBeAnInstanceOf('Pim\\Bundle\\VersioningBundle\\Model\\Version');
$version->getAuthor()->shouldReturn('baz');
$version->isPending()->shouldReturn(true);
}
示例6:
function it_should_compose_the_deb(Parser $parser, Packager $packager, StandardFile $control)
{
$packager->run()->willReturn($packager);
$packager->build()->willReturn("dpkg -b something.deb");
$packager->getControl()->willReturn($control);
$packager->setOutputPath("/path/to/out")->shouldBeCalledTimes(1);
$packager->mount("/here", "/mnt/one")->shouldBeCalledTimes(1);
$packager->mount("/here2", "/mnt/two")->shouldBeCalledTimes(1);
$control->offsetSet("Package-Name", "my-package-name")->shouldBeCalledTimes(1);
$control->offsetSet("Version", "0.0.1")->shouldBeCalledTimes(1);
$yml = ["output_path" => "/path/to/out", "control" => ["package_name" => "my-package-name", "version" => "0.0.1"], "mount" => [["src" => "/here", "dest" => "/mnt/one"], ["src" => "/here2", "dest" => "/mnt/two"]]];
$parser->parse(Argument::Any())->willReturn($yml);
$this->compose("parser is mocked out")->shouldReturn("dpkg -b something.deb");
}
示例7: testCalibration
public function testCalibration()
{
$strategy = $this->prophesize("Bench\\IterationStrategy");
$strategy->getIterateCount(Argument::Any(), Argument::Any())->willReturn(10);
$b = new B("test", $strategy->reveal());
$b->times();
usleep(1000.0);
$b->times();
$actualDuration = $b->getDuration();
$calibration = new B("Calibration", $strategy->reveal());
$calibration->times();
usleep(100.0);
$calibration->times();
$b->calibrateWith($calibration);
$this->assertLessThan($actualDuration, $b->getDuration());
}
示例8: testUpdate
public function testUpdate()
{
$response = $this->dummy_response();
$api = $this->prophet->prophesize('\\Push_API\\API');
$api->update_article("123", "456", Argument::Any(), array())->willReturn($response)->shouldBeCalled();
// Create post, simulate that the post has been synced
$post_id = $this->factory->post->create();
update_post_meta($post_id, 'apple_export_api_id', 123);
update_post_meta($post_id, 'apple_export_api_revision', 456);
$action = new Push($this->settings, $post_id);
$action->set_api($api->reveal());
$action->perform();
$this->assertEquals($response->data->id, get_post_meta($post_id, 'apple_export_api_id', true));
$this->assertEquals($response->data->createdAt, get_post_meta($post_id, 'apple_export_api_created_at', true));
$this->assertEquals($response->data->modifiedAt, get_post_meta($post_id, 'apple_export_api_modified_at', true));
$this->assertEquals($response->data->shareUrl, get_post_meta($post_id, 'apple_export_api_share_url', true));
$this->assertEquals(null, get_post_meta($post_id, 'apple_export_api_deleted', true));
}
示例9:
function it_creates_a_version_on_object_deletion($versionFactory, $versionRepository, $tokenStorage, $authorizationChecker, $versionSaver, Version $previousVersion, Version $removeVersion, TokenInterface $token, UserInterface $admin, VersionableInterface $price, RemoveEvent $event)
{
$tokenStorage->getToken()->willReturn($token);
$token->getUser()->willReturn($admin);
$admin->getUsername()->willReturn('admin');
$authorizationChecker->isGranted('IS_AUTHENTICATED_REMEMBERED')->willReturn(true);
$versionRepository->getNewestLogEntry(Argument::any(), 12)->willReturn($previousVersion);
$previousVersion->getVersion()->willReturn(11);
$previousVersion->getSnapshot()->willReturn(['foo' => 'bar']);
$versionFactory->create(Argument::Any(), 12, 'admin', 'Deleted')->willReturn($removeVersion);
$removeVersion->setVersion(12)->willReturn($removeVersion);
$removeVersion->setSnapshot(['foo' => 'bar'])->willReturn($removeVersion);
$removeVersion->setChangeset([])->willReturn($removeVersion);
$versionSaver->save($removeVersion)->shouldBeCalled();
$event->getSubject()->willReturn($price);
$event->getSubjectId()->willReturn(12);
$this->postRemove($event);
}
示例10: it_register_service_command_resolver
public function it_register_service_command_resolver(Container $container)
{
$container->offsetSet('command.resolver', Argument::Any())->shouldBeCalled();
$this->register($container);
}
示例11:
function it_should_capture_any_kind_of_error_as_internal_server_error(UrlMatcher $matcher, AnnotExecutor $executor, Request $request, Response $response)
{
$matcher->matchRequest(Argument::Any())->willThrow("Exception");
$response->setStatusCode(500)->shouldBeCalled();
$this->run($request, $response)->shouldBe($response);
}
示例12: it_should_trigger_the_mark_it_event_during_the_far_call
public function it_should_trigger_the_mark_it_event_during_the_far_call(EventManager $eventManager)
{
$eventManager->trigger("mark-it", Argument::Any())->shouldBeCalledTimes(1);
$this->far();
}
示例13: testTagsFieldIsMergedWithGlobalTags
public function testTagsFieldIsMergedWithGlobalTags()
{
$options = new Options();
$options->setDatabase("db");
$options->setTags(["dc" => "us-west"]);
$httpClient = $this->prophesize("GuzzleHttp\\Client");
$httpClient->post(Argument::Any(), ["auth" => ["root", "root"], "query" => ["db" => "db", "retentionPolicy" => "default"], "body" => 'tcp.test,dc=us-west,region=us mark="element" 1257894000000000000'])->shouldBeCalledTimes(1);
$adapter = new InfluxHttpAdapter($httpClient->reveal(), $options);
$adapter->send(["time" => "2009-11-10T23:00:00Z", "tags" => ["region" => "us"], "points" => [["measurement" => "tcp.test", "fields" => ["mark" => "element"]]]]);
}
示例14:
function its_method_get_package_should_return_a_package($client)
{
$client->makeApiCall(Argument::Any(), null, null)->willReturn('{ "version": "v1", "associations": { "mainpic": { "type": "picture", "uri": "http://publicapi:5050/items/tag%3Ademodata.org%2C0001%3Aninjs_XYZ123" }, "storyText": { "type": "text", "uri": "http://publicapi:5050/items/tag%3Ademodata.org%2C0003%3Aninjs_XYZ123" } }, "person": [ { "name": "Hulk Hogan", "rel": "author" }, { "name": "The Phototaker", "rel": "photographer" } ], "_links": { "parent": { "title": "home", "href": "/" }, "collection": { "title": "packages", "href": "packages" }, "self": { "title": "Package", "href": "packages/tag:demodata.org,0012:ninjs_XYZ123" } }, "body_text": "Want to try McRide or McGhostHouse?", "profile": "text-photo", "copyrightnotice": "Free to use for everyone", "pubstatus": "usable", "language": "en", "type": "composite", "located": "Bilbao city center, Spain", "subject": [ { "name": "Business", "rel": "about" }, { "name": "Economy", "rel": "about" }, { "name": "Entertainment", "rel": "about" } ], "urgency": 8, "uri": "http://publicapi:5050/packages/tag%3Ademodata.org%2C0012%3Aninjs_XYZ123", "headline": "McDonalds opens its own theme park", "versioncreated": "2014-08-15T11:33:42+0000", "body_html": "<p>Want to try <em>McRide</em> or <em>McGhostHouse</em>?</p>", "byline": "Hulk Hogan, The Undertaker", "place": [ { "name": "Bilbao" }, { "name": "Spain" } ] }');
$this->getPackage(Argument::any())->shouldReturnAnInstanceOf('Superdesk\\ContentApiSdk\\Data\\Package');
}
示例15: prepareDns
private function prepareDns($values)
{
$dns = $this->prophesize("Corley\\Service\\Dns");
$dns->resolve(Argument::Any())->willReturn($values);
return $dns->reveal();
}