本文整理汇总了PHP中Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP ParamConverter::expects方法的具体用法?PHP ParamConverter::expects怎么用?PHP ParamConverter::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter
的用法示例。
在下文中一共展示了ParamConverter::expects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testApplyConverterOnUserCreatesUser
public function testApplyConverterOnUserCreatesUser()
{
$id = Uuid::createNew();
$user = new UserReadModel($id, 'user', 'email', 'name', 1);
$request = Request::createFromGlobals();
$request->attributes->set('id', $id);
$this->userService->expects(self::once())->method('getUser')->with($id)->will(self::returnValue($user));
$this->configuration->expects(self::once())->method('getOptions')->will(self::returnValue(['id' => 'id']));
$this->configuration->expects(self::atLeastOnce())->method('getClass')->will(self::returnValue(UserResource::class));
$this->configuration->expects(self::atLeastOnce())->method('getName')->will(self::returnValue('user'));
$converter = new ParamConverter($this->bookService, $this->userService);
$converter->apply($request, $this->configuration);
self::assertEquals($user->getId()->getValue(), $request->attributes->get('user')->getId()->getValue());
}