protected function setUp()
 {
     $this->tokenStorage = M::mock(TokenStorage::class);
     $this->token = M::mock(UsernamePasswordToken::class);
     $this->user = M::mock(User::class);
     parent::setUp();
     $this->getCommand();
 }
 protected function setUp()
 {
     parent::setUp();
     $this->service = new GeneratorService();
     $this->service->setAnnotationReader(new AnnotationReader());
     $this->twigEngine = new TwigEngineMokcup();
     $this->service->setTwigEngine($this->twigEngine);
 }
 protected function setUp()
 {
     parent::setUp();
     $this->service = new GeneratorService();
     $this->service->setAnnotationReader(new AnnotationReader());
     $this->twigEngine = new TwigEngineMokcup();
     $this->service->setTwigEngine($this->twigEngine);
     $this->service->setModelFieldsParameters(array("date" => array("format" => "d-m-y")));
 }
Ejemplo n.º 4
0
 public function setUp()
 {
     parent::setUp();
     $this->builder = $this->getMockForAbstractClass('Symfony\\Component\\Validator\\Violation\\ConstraintViolationBuilderInterface');
     $this->builder->expects($this->any())->method('atPath')->will($this->returnValue($this->builder));
     $context = $this->getMockForAbstractClass('Symfony\\Component\\Validator\\Context\\ExecutionContextInterface');
     $context->expects($this->any())->method('buildViolation')->will($this->returnValue($this->builder));
     $this->validator = new ReturnItemValidator();
     $this->validator->initialize($context);
 }
 protected function setUp()
 {
     parent::setUp();
     $this->container = new Container();
     $this->container->setParameter('hwi_oauth.templating.engine', 'twig');
     $this->container->setParameter('hwi_oauth.connect', true);
     $this->container->setParameter('hwi_oauth.firewall_names', array('default'));
     $this->container->setParameter('hwi_oauth.connect.confirmation', true);
     if (interface_exists('Symfony\\Component\\Security\\Core\\Authorization\\AuthorizationCheckerInterface')) {
         $this->authorizationChecker = $this->getMockBuilder('\\Symfony\\Component\\Security\\Core\\Authorization\\AuthorizationCheckerInterface')->getMock();
         $this->container->set('security.authorization_checker', $this->authorizationChecker);
         $this->tokenStorage = $this->getMockBuilder('\\Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorageInterface')->getMock();
         $this->container->set('security.token_storage', $this->tokenStorage);
     } else {
         $this->securityContext = $this->getMockBuilder('\\Symfony\\Component\\Security\\Core\\SecurityContextInterface')->getMock();
         $this->container->set('security.context', $this->securityContext);
     }
     $this->templating = $this->getMockBuilder('Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface')->getMock();
     $this->container->set('templating', $this->templating);
     $this->router = $this->getMockBuilder('Symfony\\Component\\Routing\\RouterInterface')->getMock();
     $this->container->set('router', $this->router);
     $this->resourceOwner = $this->getMockBuilder('HWI\\Bundle\\OAuthBundle\\OAuth\\ResourceOwnerInterface')->getMock();
     $this->resourceOwner->expects($this->any())->method('getUserInformation')->willReturn(new CustomUserResponse());
     $this->resourceOwnerMap = $this->getMockBuilder('HWI\\Bundle\\OAuthBundle\\Security\\Http\\ResourceOwnerMap')->disableOriginalConstructor()->getMock();
     $this->resourceOwnerMap->expects($this->any())->method('getResourceOwnerByName')->withAnyParameters()->willReturn($this->resourceOwner);
     $this->container->set('hwi_oauth.resource_ownermap.default', $this->resourceOwnerMap);
     $this->accountConnector = $this->getMockBuilder('HWI\\Bundle\\OAuthBundle\\Connect\\AccountConnectorInterface')->getMock();
     $this->container->set('hwi_oauth.account.connector', $this->accountConnector);
     $this->oAuthUtils = $this->getMockBuilder('HWI\\Bundle\\OAuthBundle\\Security\\OAuthUtils')->disableOriginalConstructor()->getMock();
     $this->container->set('hwi_oauth.security.oauth_utils', $this->oAuthUtils);
     $this->userChecker = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface')->getMock();
     $this->container->set('hwi_oauth.user_checker', $this->userChecker);
     $this->eventDispatcher = $this->getMockBuilder('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface')->getMock();
     $this->container->set('event_dispatcher', $this->eventDispatcher);
     $this->formFactory = $this->getMockBuilder('Symfony\\Component\\Form\\FormFactoryInterface')->getMock();
     $this->container->set('form.factory', $this->formFactory);
     $this->session = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\Session\\SessionInterface')->getMock();
     $this->request = Request::create('/');
     $this->request->setSession($this->session);
     $this->controller = new ConnectController();
     $this->controller->setContainer($this->container);
 }