/** * @before */ public function setupAdapter() { $this->prophecy = $this->prophesize('League\\Flysystem\\AdapterInterface'); $this->adapter = $this->prophecy->reveal(); $this->filesystem = new Filesystem($this->adapter); $this->config = Argument::type('League\\Flysystem\\Config'); }
public function setUp() { $this->em = $this->prophesize(EntityManagerInterface::class); $this->em->persist(Argument::any())->willReturn(null); $this->em->flush()->willReturn(null); $this->service = new ShortUrlService($this->em->reveal()); }
/** * @{inheritdoc} */ public function setUp() { parent::setUp(); $this->repository = $this->prophesize('AppBundle\\Repository\\EntityRepositoryInterface'); $this->managerRegistry = $this->prophesize('Doctrine\\Common\\Persistence\\ManagerRegistry'); $this->manager = new ObjectManager($this->repository->reveal(), $this->managerRegistry->reveal()); }
/** * Builds a fake object using Prophecy */ public function buildFakeObject() { if (!isset($this->prophecy)) { $this->initProphecy(); } return $this->prophecy->reveal(); }
protected function setUp() { $this->cache = $this->prophesize(Cache::class); $this->repository = $this->prophesize(DataboxRepository::class); $this->factory = $this->prophesize(DataboxFactory::class); $this->sut = new CachingDataboxRepositoryDecorator($this->repository->reveal(), $this->cache->reveal(), $this->cacheKey, $this->factory->reveal()); }
public function setUp() { $this->urlShortener = $this->prophesize(UrlShortener::class); $visitTracker = $this->prophesize(VisitsTracker::class); $visitTracker->track(Argument::any()); $this->action = new RedirectAction($this->urlShortener->reveal(), $visitTracker->reveal()); }
public function testInvokesSignatureVerifier() { $expected = new GnupgVerificationResult(['fingerprint' => 'foobar', 'summary' => 'baz']); $this->verifier->verify('foo', 'bar')->willReturn($expected); $service = new SignatureService($this->verifier->reveal()); $this->assertEquals($expected, $service->verify('foo', 'bar')); }
protected function setUp() { parent::setUp(); $this->decoderMock = $this->createDecoderMock(); $this->encoderMock = $this->createEncoderMock(); $this->transcoder = new Transcoder($this->decoderMock->reveal(), $this->encoderMock->reveal()); }
public function testGetTemplateFilename() { $config = new SkelCommandConfig($this->cliOptionsProphecy->reveal(), '/tmp/'); $expected = realpath(__DIR__ . '/../../../../conf/phive.skeleton.xml'); $actual = realpath($config->getTemplateFilename()); $this->assertEquals($expected, $actual); }
protected function setUp() { parent::setUp(); $this->repositoryConnector = $this->prophesize('ConsoleHelpers\\SVNBuddy\\Repository\\Connector\\Connector'); $this->commandConfig = $this->prophesize('\\ConsoleHelpers\\SVNBuddy\\Config\\CommandConfig'); $this->workingCopyConflictTracker = new WorkingCopyConflictTracker($this->repositoryConnector->reveal(), $this->commandConfig->reveal()); }
protected function setUp() { $this->subject = new DatabaseUserPermissionCheck(); $this->beUserProphecy = $this->prophesize(BackendUserAuthentication::class); $GLOBALS['BE_USER'] = $this->beUserProphecy->reveal(); $GLOBALS['BE_USER']->user['uid'] = 42; }
public function setUp() { parent::setUp(); /** @var LoggerInterface|ObjectProphecy $logger */ $this->logger = $this->prophesize("\\Psr\\Log\\LoggerInterface"); /** @var EventDispatcher|ObjectProphecy $eventDispatcher */ $this->eventDispatcher = $this->prophesize("\\Symfony\\Component\\EventDispatcher\\EventDispatcher"); /** @var MiraklApiInterface|ObjectProphecy mirakl */ $this->mirakl = $this->prophesize("\\HiPay\\Wallet\\Mirakl\\Api\\Mirakl\\ApiInterface"); /** @var HiPayApiInterface|ObjectProphecy $hipay */ $this->hipay = $this->prophesize("\\HiPay\\Wallet\\Mirakl\\Api\\HiPay\\ApiInterface"); $this->apiFactory = $this->prophesize("\\HiPay\\Wallet\\Mirakl\\Api\\Factory"); $this->apiFactory->getHiPay()->willReturn($this->hipay->reveal()); $this->apiFactory->getMirakl()->willReturn($this->mirakl->reveal()); /** @var VendorManagerInterface|ObjectProphecy $vendorManager */ $this->vendorManager = $this->prophesize("HiPay\\Wallet\\Mirakl\\Vendor\\Model\\VendorManagerInterface"); /** @var DocumentManagerInterface|ObjectProphecy $documentManager */ $this->documentManager = $this->prophesize("HiPay\\Wallet\\Mirakl\\Vendor\\Model\\DocumentManagerInterface"); /** @var OperationManagerInterface|ObjectProphecy $operationManager */ $this->operationManager = $this->prophesize("\\HiPay\\Wallet\\Mirakl\\Cashout\\Model\\Operation\\ManagerInterface"); /** @var ValidatorInterface|ObjectProphecy $transactionValidator */ $this->transactionValidator = $this->prophesize("\\HiPay\\Wallet\\Mirakl\\Cashout\\Model\\Transaction\\ValidatorInterface"); $this->operator = new Vendor("*****@*****.**", rand()); $this->technical = new Vendor("*****@*****.**", rand()); }
/** * Create a new database connection mock object for every test. * * @return void */ protected function setUp() { parent::setUp(); $this->typoScriptFrontendController = $this->prophesize(TypoScriptFrontendController::class); $GLOBALS['TSFE'] = $this->typoScriptFrontendController->reveal(); $this->subject = GeneralUtility::makeInstance(QueryContext::class); }
/** * {@inheritdoc} */ public function setUp() { parent::setUp(); $this->entityStorage = $this->prophesize(EntityStorageInterface::class); $this->requestHandler = new RequestHandler($this->entityStorage->reveal()); $this->requestHandler->setContainer($this->container); }
public function setUp() { $this->eventRepository = $this->prophesize('AppBundle\\Entity\\EventRepository'); $this->context = $this->prophesize('Symfony\\Component\\Validator\\Context\\ExecutionContextInterface'); $this->validator = new UniqueEventValidator($this->eventRepository->reveal()); $this->validator->initialize($this->context->reveal()); }
public function setUp() { $router = $this->prophesize(RouterInterface::class); $router->generateUri(Argument::cetera())->willReturn('/foo/bar'); $this->urlShortener = $this->prophesize(UrlShortener::class); $this->action = new QrCodeAction($router->reveal(), $this->urlShortener->reveal()); }
protected function setUp() { $this->reader = $this->prophesize('Doctrine\\Common\\Annotations\\Reader'); $this->processorFactory = $this->prophesize('Kcs\\Metadata\\Loader\\Processor\\ProcessorFactoryInterface'); $this->loader = new AnnotationProcessorLoader($this->processorFactory->reveal()); $this->loader->setReader($this->reader->reveal()); }
public function setUp() { parent::setUp(); $this->securityChecker = $this->prophesize(SecurityCheckerInterface::class); $this->securityListener = new SuluSecurityListener($this->securityChecker->reveal()); $this->filterControllerEvent = $this->prophesize(FilterControllerEvent::class); }
public function setUp() { $this->tokenStorage = $this->prophesize('Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorage'); $this->validator = $this->prophesize('Symfony\\Component\\Validator\\Validator\\ValidatorInterface'); $this->logger = $this->prophesize('Psr\\Log\\LoggerInterface'); $this->subscriber = new EntitySubscriber($this->tokenStorage->reveal(), $this->validator->reveal(), $this->logger->reveal()); }
protected function setUp() { $this->dbProphecy = $this->prophesize(DatabaseConnection::class); $GLOBALS['TYPO3_DB'] = $this->dbProphecy->reveal(); $GLOBALS['TCA']['pages_language_overlay'] = array(); $this->subject = new DatabasePageLanguageOverlayRows(); }
/** * @expectedException \Linio\DynamicFormBundle\Exception\FormlyMapperException */ public function testIsThrowingNonExistentFormException() { $formName = 'foo'; $this->formFactoryMock->getConfiguration($formName)->willThrow('Linio\\DynamicFormBundle\\Exception\\NonExistentFormException'); $this->formlyMapper->setFormFactory($this->formFactoryMock->reveal()); $this->formlyMapper->map($formName); }
protected function setUp() { $this->dbProphecy = $this->prophesize(DatabaseConnection::class); $GLOBALS['TYPO3_DB'] = $this->dbProphecy->reveal(); $this->beUserProphecy = $this->prophesize(BackendUserAuthentication::class); $GLOBALS['BE_USER'] = $this->beUserProphecy; $this->subject = new DatabaseLanguageRows(); }
public function testFlushClearMessages() { $this->sqsClient->sendMessageBatch(Argument::any())->shouldBeCalledTimes(1); $queue = new MessageQueue('https://queue-url.aws.com', $this->sqsClient->reveal()); $queue->push(new Message('message-name', ['id' => 1])); $queue->flush(); $queue->flush(); }
public function testReturnsExpectedArrayOfUrls() { $alias = new PharAlias('phpunit', new AnyVersionConstraint()); $urls = [new Url('https://example.com/foo'), new Url('https://example.com/bar')]; $this->repositoryList->getRepositoryUrls($alias)->shouldBeCalled()->willReturn($urls); $resolver = new AliasResolver($this->repositoryList->reveal()); $this->assertEquals($urls, $resolver->resolve($alias)); }
public function testAjaxImageUploadForm() { $app = $this->prophesize('Zend\\Mvc\\Application'); $app->getMvcEvent()->willReturn($this->prophesize('Zend\\Mvc\\MvcEvent')); $this->locator->get('Application')->willReturn($app); $form = $this->ajaxImageUploadFormFactory->createService($this->controllerManager->reveal()); $this->assertInstanceOf('LearnZF2AjaxImageGallery\\Form\\AjaxImageUploadForm', $form); }
public function setUp() { $this->urlShortener = $this->prophesize(UrlShortener::class); $command = new GenerateShortcodeCommand($this->urlShortener->reveal(), Translator::factory([]), ['schema' => 'http', 'hostname' => 'foo.com']); $app = new Application(); $app->add($command); $this->commandTester = new CommandTester($command); }
protected function setUp() { parent::setUp(); $this->mailer = $this->prophesize('Pitech\\MailerBundle\\Mailer\\MailerInterface'); $this->provider = $this->prophesize('Pitech\\MailerBundle\\Provider\\MailerProviderInterface'); $this->message = $this->prophesize('Pitech\\MailerBundle\\Model\\MailMessageInterface'); $this->class = new MailResolver(self::$defaults, $this->mailer->reveal(), $this->provider->reveal()); }
public function setUp() { $this->urlShortener = $this->prophesize(UrlShortener::class); $command = new ResolveUrlCommand($this->urlShortener->reveal(), Translator::factory([])); $app = new Application(); $app->add($command); $this->commandTester = new CommandTester($command); }
public function setUp() { $this->image = $this->prophesize(Image::class); $this->filesystem = $this->prophesize(Filesystem::class); $this->generator = new PreviewGenerator(new ImageBuilder(new ServiceManager(), ['factories' => [Image::class => function () { return $this->image->reveal(); }]]), $this->filesystem->reveal(), 'dir'); }
public function testSendMail() { $this->event->getType()->shouldBeCalledTimes(1)->willReturn('email_type1'); $this->event->getTo()->shouldBeCalledTimes(1)->willReturn('*****@*****.**'); $this->event->getParams()->shouldBeCalledTimes(1)->willReturn([]); $this->mailResolver->sendMail('email_type1', '*****@*****.**', [])->shouldBeCalledTimes(1); $this->class->sendMail($this->event->reveal()); }