public function testCheckConnection()
 {
     $map = [['a', 'b', 'c', 'd'], ['e', 'f', 'g', 'h']];
     $this->xmlRpcClient->method('call')->willReturnMap($map);
     $connection = new Connection($this->xmlRpcClient);
     $this->assertInternalType('int', $connection->checkConnection());
 }
 protected function setUp()
 {
     $grammar = new PostgresGrammar();
     $this->connection = $this->createMock(PostgresConnection::class);
     $this->connection->method('getSchemaGrammar')->willReturn($grammar);
     $this->builder = new PostgresBuilder($this->connection);
 }
 public function test_behat_command_added_to_config_if_phpunit_is_installed()
 {
     $this->packageHelper->method('hasPackage')->willReturnMap([['behat/behat', null, $this->input, $this->output, true]]);
     $this->questionHelper->method('confirmRunBehat')->willReturn(true);
     $actual = $this->sut->createConfig($this->input, $this->output);
     self::assertContains('vendor/bin/behat', $actual->getScript());
 }
 public function testItDisplaysAConfirmationMessage()
 {
     $expectedMessage = 'Status of product "test": enabled';
     $this->mockOutput->expects($this->once())->method('writeln')->with('<info>' . $expectedMessage . '</info>');
     $this->mockInput->method('getArgument')->willReturn('test');
     $this->command->run($this->mockInput, $this->mockOutput);
 }
 /**
  * @see \PHPUnit_Framework_TestCase::setUp()
  */
 protected function setUp()
 {
     $repositories = $this->getMockBuilder(RepositoryService::class)->disableOriginalConstructor()->getMock();
     $this->services = $this->getMockBuilder(ServiceLocatorInterface::class)->getMock();
     $this->services->method('get')->will($this->returnValueMap([['repositories', $repositories]]));
     $this->subscriber = new RepositoryEventsSubscriber($this->services);
 }
 /**
  * @param array $options
  * @param int $expectedPersistCount
  * @dataProvider executeDataProvider
  */
 public function testExecute(array $options, $expectedPersistCount, $exceptionMessage)
 {
     $em = $this->getMockBuilder('\\Doctrine\\Common\\Persistence\\ObjectManager')->disableOriginalConstructor()->getMock();
     $em->expects($this->exactly($expectedPersistCount))->method('persist')->will($this->returnCallback(function ($object) use($options) {
         if ('Oro\\Bundle\\CalendarBundle\\Entity\\CalendarEvent' === get_class($object)) {
             $this->assertEquals($options[CreateCalendarEventAction::OPTION_KEY_TITLE], $object->getTitle());
             $this->assertEquals($options[CreateCalendarEventAction::OPTION_KEY_START], $object->getStart());
             if (isset($options[CreateCalendarEventAction::OPTION_KEY_END])) {
                 $this->assertEquals($options[CreateCalendarEventAction::OPTION_KEY_END], $object->getEnd());
             } elseif (isset($options[CreateCalendarEventAction::OPTION_KEY_DURATION])) {
                 $this->assertEquals($options[CreateCalendarEventAction::OPTION_KEY_START]->modify('+ ' . $options[CreateCalendarEventAction::OPTION_KEY_DURATION]), $object->getEnd());
             } else {
                 $this->assertEquals($options[CreateCalendarEventAction::OPTION_KEY_START]->modify('+ 1 hour'), $object->getEnd());
             }
         } elseif ('Oro\\Bundle\\ReminderBundle\\Entity\\Reminder' === get_class($object)) {
             $this->assertEquals($options[CreateCalendarEventAction::OPTION_KEY_TITLE], $object->getSubject());
         } else {
             throw new \InvalidArgumentException(sprintf('Persistent object must be "%s" or "%s"', self::CLASS_NAME_CALENDAR_EVENT, self::CLASS_NAME_REMINDER));
         }
     }));
     $this->registry->method('getManagerForClass')->willReturn($em);
     if ($exceptionMessage) {
         $this->setExpectedException('\\Oro\\Bundle\\WorkflowBundle\\Exception\\InvalidParameterException', $exceptionMessage);
     }
     $action = $this->getAction();
     $context = new ItemStub([]);
     $action->initialize($options);
     $action->execute($context);
 }
 /**
  * @param mixed $value
  */
 private function setSkeletonToReturn($value)
 {
     if (is_string($value)) {
         $value = new $value();
     }
     $this->skeleton->method('get')->willReturn($value);
 }
 protected function setUp()
 {
     parent::setUp();
     $this->setCollectionFactory = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Set\\CollectionFactory', ['create'], [], '', false);
     $this->setCollection = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Set\\Collection', ['setEntityTypeFilter'], [], '', false);
     $this->setCollectionFactory->expects($this->any())->method('create')->will($this->returnValue($this->setCollection));
     $this->setCollection->expects($this->any())->method('setEntityTypeFilter')->will($this->returnValue([]));
     $this->attrCollectionFactory = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\CollectionFactory', ['create', 'addFieldToFilter'], [], '', false);
     $this->attrCollectionFactory->expects($this->any())->method('create')->will($this->returnSelf());
     $this->attrCollectionFactory->expects($this->any())->method('addFieldToFilter')->willReturn([]);
     $this->entityModel = $this->getMock('Magento\\CatalogImportExport\\Model\\Import\\Product', ['getErrorAggregator', 'getNewSku', 'getOldSku', 'getNextBunch', 'isRowAllowedToImport', 'getRowScope'], [], '', false);
     $this->entityModel->method('getErrorAggregator')->willReturn($this->getErrorAggregatorObject());
     $this->params = [0 => $this->entityModel, 1 => 'grouped'];
     $this->links = $this->getMock('Magento\\GroupedImportExport\\Model\\Import\\Product\\Type\\Grouped\\Links', [], [], '', false);
     $entityAttributes = [['attribute_set_name' => 'attribute_id', 'attribute_id' => 'attributeSetName']];
     $this->connection = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', ['select', 'fetchAll', 'fetchPairs', 'joinLeft', 'insertOnDuplicate', 'delete', 'quoteInto'], [], '', false);
     $this->select = $this->getMock('Magento\\Framework\\DB\\Select', ['from', 'where', 'joinLeft', 'getConnection'], [], '', false);
     $this->select->expects($this->any())->method('from')->will($this->returnSelf());
     $this->select->expects($this->any())->method('where')->will($this->returnSelf());
     $this->select->expects($this->any())->method('joinLeft')->will($this->returnSelf());
     $this->connection->expects($this->any())->method('select')->will($this->returnValue($this->select));
     $connectionMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $connectionMock->expects($this->any())->method('quoteInto')->will($this->returnValue('query'));
     $this->select->expects($this->any())->method('getConnection')->willReturn($connectionMock);
     $this->connection->expects($this->any())->method('insertOnDuplicate')->willReturnSelf();
     $this->connection->expects($this->any())->method('delete')->willReturnSelf();
     $this->connection->expects($this->any())->method('quoteInto')->willReturn('');
     $this->connection->expects($this->any())->method('fetchAll')->will($this->returnValue($entityAttributes));
     $this->resource = $this->getMock('\\Magento\\Framework\\App\\ResourceConnection', ['getConnection', 'getTableName'], [], '', false);
     $this->resource->expects($this->any())->method('getConnection')->will($this->returnValue($this->connection));
     $this->resource->expects($this->any())->method('getTableName')->will($this->returnValue('tableName'));
     $this->grouped = $this->objectManagerHelper->getObject('Magento\\GroupedImportExport\\Model\\Import\\Product\\Type\\Grouped', ['attrSetColFac' => $this->setCollectionFactory, 'prodAttrColFac' => $this->attrCollectionFactory, 'resource' => $this->resource, 'params' => $this->params, 'links' => $this->links]);
 }
 protected function setUp()
 {
     parent::setUp();
     $this->entityModel = $this->getMock('Magento\\CatalogImportExport\\Model\\Import\\Product', ['getErrorAggregator', 'getBehavior', 'getNewSku', 'getNextBunch', 'isRowAllowedToImport', 'getRowScope', 'getConnection'], [], '', false);
     $this->entityModel->method('getErrorAggregator')->willReturn($this->getErrorAggregatorObject());
     $this->connection = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', ['select', 'fetchAll', 'fetchPairs', 'joinLeft', 'insertOnDuplicate', 'delete', 'quoteInto', 'fetchAssoc'], [], '', false);
     $this->select = $this->getMock('Magento\\Framework\\DB\\Select', [], [], '', false);
     $this->select->expects($this->any())->method('from')->will($this->returnSelf());
     $this->select->expects($this->any())->method('where')->will($this->returnSelf());
     $this->select->expects($this->any())->method('joinLeft')->will($this->returnSelf());
     $this->select->expects($this->any())->method('getConnection')->willReturn($this->connection);
     $this->connection->expects($this->any())->method('select')->will($this->returnValue($this->select));
     $this->initFetchAllCalls();
     $this->connection->expects($this->any())->method('insertOnDuplicate')->willReturnSelf();
     $this->connection->expects($this->any())->method('delete')->willReturnSelf();
     $this->connection->expects($this->any())->method('quoteInto')->willReturn('');
     $this->resource = $this->getMock('Magento\\Framework\\App\\ResourceConnection', ['getConnection', 'getTableName'], [], '', false);
     $this->resource->expects($this->any())->method('getConnection')->will($this->returnValue($this->connection));
     $this->resource->expects($this->any())->method('getTableName')->will($this->returnValue('tableName'));
     $this->attrSetColFac = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Set\\CollectionFactory', ['create'], [], '', false);
     $this->setCollection = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Set\\Collection', ['setEntityTypeFilter'], [], '', false);
     $this->attrSetColFac->expects($this->any())->method('create')->will($this->returnValue($this->setCollection));
     $this->setCollection->expects($this->any())->method('setEntityTypeFilter')->will($this->returnValue([]));
     $this->prodAttrColFac = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\CollectionFactory', ['create'], [], '', false);
     $attrCollection = $this->getMock('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\Collection', [], [], '', false);
     $attrCollection->expects($this->any())->method('addFieldToFilter')->willReturn([]);
     $this->prodAttrColFac->expects($this->any())->method('create')->will($this->returnValue($attrCollection));
     $this->params = [0 => $this->entityModel, 1 => 'bundle'];
     $this->bundle = $this->objectManagerHelper->getObject('Magento\\BundleImportExport\\Model\\Import\\Product\\Type\\Bundle', ['attrSetColFac' => $this->attrSetColFac, 'prodAttrColFac' => $this->prodAttrColFac, 'resource' => $this->resource, 'params' => $this->params]);
 }
Exemple #10
0
 public function testWriteNotTimeToCleanYet()
 {
     $this->db->method('fetchValue')->willReturn(5);
     $this->db->expects($this->never())->method('exec')->with($this->stringStartsWith('DELETE'));
     $this->dbHandler->setCleanProbability(100);
     $this->dbHandler->handle(self::$testRecord);
 }
Exemple #11
0
 /**
  * Tests expandDependencies() when no variants exist and there are no static
  * (non-variant) dependencies.
  *
  * @covers ::expandDependencies
  */
 public function testExpandDependenciesNoVariantsOrStaticDependencies()
 {
     $this->query->method('execute')->willReturn([]);
     $dependencies = ['required' => ['d6_node:*', 'd6_node_revision:*']];
     $dependencies = $this->storage->expandDependencies($dependencies);
     $this->assertSame([], $dependencies['required']);
 }
 protected function setUp()
 {
     $objectManager = new ObjectManager($this);
     $this->connection = $this->getMockBuilder('\\Magento\\Framework\\DB\\Adapter\\AdapterInterface')->disableOriginalConstructor()->getMock();
     $this->connection->expects($this->any())->method('quoteInto')->willReturnCallback(function ($query, $expression) {
         return str_replace('?', $expression, $query);
     });
     $this->resource = $this->getMockBuilder('\\Magento\\Framework\\App\\ResourceConnection')->disableOriginalConstructor()->getMock();
     $this->resource->method('getTableName')->willReturnCallback(function ($table) {
         return 'prefix_' . $table;
     });
     $this->resource->expects($this->any())->method('getConnection')->willReturn($this->connection);
     $this->website = $this->getMockBuilder('\\Magento\\Store\\Api\\Data\\WebsiteInterface')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->website->expects($this->any())->method('getId')->willReturn(self::WEBSITE_ID);
     $this->store = $this->getMockBuilder('\\Magento\\Store\\Api\\Data\\StoreInterface')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->store->expects($this->any())->method('getId')->willReturn(self::STORE_ID);
     $this->storeManager = $this->getMockBuilder('\\Magento\\Store\\Model\\StoreManagerInterface')->disableOriginalConstructor()->getMock();
     $this->storeManager->expects($this->any())->method('getWebsite')->willReturn($this->website);
     $this->storeManager->expects($this->any())->method('getStore')->willReturn($this->store);
     $this->attributeCollection = $this->getMockBuilder('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\Collection')->disableOriginalConstructor()->getMock();
     $attributeCollectionFactory = $this->getMockBuilder('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\CollectionFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $attributeCollectionFactory->expects($this->once())->method('create')->willReturn($this->attributeCollection);
     $this->target = $objectManager->getObject('\\Magento\\CatalogSearch\\Model\\Search\\TableMapper', ['resource' => $this->resource, 'storeManager' => $this->storeManager, 'attributeCollectionFactory' => $attributeCollectionFactory]);
     $this->select = $this->getMockBuilder('\\Magento\\Framework\\DB\\Select')->disableOriginalConstructor()->getMock();
     $this->request = $this->getMockBuilder('\\Magento\\Framework\\Search\\RequestInterface')->disableOriginalConstructor()->getMock();
 }
Exemple #13
0
 /**
  * Retrieves a mocked migration.
  *
  * @return \Drupal\migrate\Entity\MigrationInterface|\PHPUnit_Framework_MockObject_MockObject
  *   The mocked migration.
  */
 protected function getMigration()
 {
     $this->migrationConfiguration += ['migrationClass' => 'Drupal\\migrate\\Entity\\Migration'];
     $this->idMap = $this->getMock('Drupal\\migrate\\Plugin\\MigrateIdMapInterface');
     $this->idMap->method('getQualifiedMapTableName')->willReturn('test_map');
     $migration = $this->getMockBuilder($this->migrationConfiguration['migrationClass'])->disableOriginalConstructor()->getMock();
     $migration->method('checkRequirements')->willReturn(TRUE);
     $migration->method('getIdMap')->willReturn($this->idMap);
     // We need the state to be toggled throughout the test so we store the value
     // on the test class and use a return callback.
     $migration->expects($this->any())->method('getStatus')->willReturnCallback(function () {
         return $this->migrationStatus;
     });
     $migration->expects($this->any())->method('setStatus')->willReturnCallback(function ($status) {
         $this->migrationStatus = $status;
     });
     $migration->method('getMigrationDependencies')->willReturn(['required' => [], 'optional' => []]);
     $configuration =& $this->migrationConfiguration;
     $migration->method('get')->willReturnCallback(function ($argument) use(&$configuration) {
         return isset($configuration[$argument]) ? $configuration[$argument] : '';
     });
     $migration->method('set')->willReturnCallback(function ($argument, $value) use(&$configuration) {
         $configuration[$argument] = $value;
     });
     $migration->method('id')->willReturn($configuration['id']);
     return $migration;
 }
 public function testItDisplaysTheStatusForAllMatchingProducts()
 {
     $this->mockInput->method('getArgument')->with('sku')->willReturn('TEST');
     $this->mockProductStatusAdapter->method('getProductStatusMatchingSku')->willReturn(['TEST1' => ProductStatusAdapterInterface::ENABLED, 'TEST2' => ProductStatusAdapterInterface::DISABLED, 'TEST3' => ProductStatusAdapterInterface::ENABLED]);
     $this->mockOutput->method('writeln')->withConsecutive(['<info>TEST1: enabled</info>'], ['<info>TEST2: disabled</info>'], ['<info>TEST3: enabled</info>']);
     $this->command->run($this->mockInput, $this->mockOutput);
 }
 public function testItDisplaysAConfirmationMessageIfThereWasNoException()
 {
     $expectedMessage = 'Status of product "test": ' . ProductStatusAdapterInterface::DISABLED;
     $this->mockOutput->expects($this->once())->method('writeln')->with($this->stringStartsWith('<info>' . $expectedMessage));
     $this->mockInput->method('getArgument')->willReturn('test');
     $this->command->run($this->mockInput, $this->mockOutput);
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->casHelper = $this->getMockBuilder('\\Drupal\\cas\\Service\\CasHelper')->disableOriginalConstructor()->getMock();
     $this->requestStack = $this->getMockBuilder('\\Symfony\\Component\\HttpFoundation\\RequestStack')->disableOriginalConstructor()->getMock();
     $this->requestStack->method('getCurrentRequest')->willReturn($this->getMock('\\Symfony\\Component\\HttpFoundation\\Request'));
 }
 public function testFailingChangeSet()
 {
     $this->cfnClientMock->method('describeChangeSet')->willReturn(new \Aws\Result(['Status' => 'FAILED', 'StatusReason' => 'FOO REASON']));
     $this->setExpectedException('Exception', 'FOO REASON');
     $blueprintAction = new \StackFormation\BlueprintAction($this->blueprintMock, $this->profileManagerMock);
     $blueprintAction->getChangeSet();
 }
Exemple #18
0
 public function testGetConfiguration()
 {
     $this->config->method('getSystemValue')->will($this->returnValueMap([['log_type', 'owncloud', 'log_type_value'], ['datadirectory', \OC::$SERVERROOT . '/data', '/data/directory/'], ['logfile', '/data/directory/owncloud.log', '/var/log/owncloud.log'], ['log_rotate_size', 0, 5 * 1024 * 1024]]));
     $this->consoleOutput->expects($this->at(0))->method('writeln')->with('Log backend ownCloud: disabled');
     $this->consoleOutput->expects($this->at(1))->method('writeln')->with('Log file: /var/log/owncloud.log');
     $this->consoleOutput->expects($this->at(2))->method('writeln')->with('Rotate at: 5 MB');
     self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
 }
 public function testTheIteratorIsValidIfWeReceivedAtLeastOneHit()
 {
     $this->client->method('search')->with($this->params)->willReturn(['hits' => ['hits' => ['foo' => 'bar']], '_scroll_id' => 'foo-scroll-id']);
     /** @noinspection PhpParamsInspection */
     $this->iterator = new SearchResponseIterator($this->client, $this->params);
     $this->iterator->rewind();
     $this->assertTrue($this->iterator->valid());
 }
 /**
  * @test
  */
 function it_skips_expressions_when_no_key_is_entered()
 {
     $interception = new TestInterception(null, 'method', ['key1' => 'value1', 'key2' => 'value2']);
     $annotation = new TestAnnotation(['key' => '']);
     $this->innerGenerator->method('generateKey')->with($interception, $annotation)->willReturn('success');
     $result = $this->keyGenerator->generateKey($interception, $annotation);
     $this->assertEquals('success', $result);
 }
 /**
  * @return SearchHandlerInterface|\PHPUnit_Framework_MockObject_MockObject
  */
 public function getMockSearchHandler()
 {
     if (!$this->searchHandler) {
         $this->searchHandler = $this->getMock('Oro\\Bundle\\FormBundle\\Autocomplete\\SearchHandlerInterface');
         $this->searchHandler->method('getProperties')->willReturn(['code', 'label']);
     }
     return $this->searchHandler;
 }
 /**
  * Setup services before tests.
  */
 protected function setUp()
 {
     $factory = $this->getMockBuilder('ONGR\\ConnectionsBundle\\Pipeline\\PipelineFactory')->setMethods(['setProgressBar'])->getMock();
     $factory->method('setProgressBar')->will($this->returnValue(null));
     $this->pipelineStarter = $this->getMockBuilder('ONGR\\ConnectionsBundle\\Pipeline\\PipelineStarter')->disableOriginalConstructor()->getMock();
     $this->pipelineStarter->setPipelineFactory($factory);
     $this->pipelineStarter->method('getPipelineFactory')->will($this->returnValue($factory));
 }
 /**
  * @return void
  */
 protected function setUp()
 {
     $this->type = $this->getMockType();
     $this->index = $this->getMockIndex();
     $this->client = $this->getMockClient();
     // now that index is setup, we can use it for mocking the Type class method getIndex
     $this->type->method('getIndex')->willReturn($this->index);
 }
 /**
  * @test
  *
  * @covers Pipedrive\Services\ValidatorProvider::register
  */
 public function shouldRegisterValidator()
 {
     $this->serviceProvider->method('register')->willReturnCallback(function (Application $app) {
         $app['validator.builder'] = $this->getMock(ValidatorInterface::class, [], [], '', false);
     });
     $app = new Application();
     $app->register($this->serviceProvider);
     $this->assertInstanceOf(ValidatorInterface::class, $app['validator.builder']);
 }
 protected function canReplaceImageWithSwatch($expected)
 {
     $this->swatchesHelperMock->expects($this->once())->method('isSwatchAttribute')->with($this->attributeMock)->willReturn($expected['isSwatchAttribute']);
     $this->attributeMock->expects($this->exactly($expected['getUsedInProductListing_count']))->method('getUsedInProductListing')->willReturn($expected['getUsedInProductListing']);
     $this->attributeMock->expects($this->exactly($expected['getIsFilterable_count']))->method('getIsFilterable')->willReturn($expected['getIsFilterable']);
     if ($expected['update_product_preview_image__count'] == 1) {
         $this->attributeMock->method('getData')->with('update_product_preview_image')->willReturn($expected['update_product_preview_image']);
     }
 }
 public function testGetSongFromSpotifyReturnsDefaultOnNotFound()
 {
     $song = new Song();
     $song->setTitle('Foo song')->setArtist('Bar');
     $this->trackFinder->method('findTrack')->willThrowException(NoTracksFoundException::emptyResult());
     $result = $this->trackConverter->getSongFromSpotify($song);
     $this->assertEquals($song->getTitle(), $result->getName(), 'Name should be set to default');
     $this->assertEquals($song->getArtist(), $result->getArtists()[0]->getName(), 'Artist should be set to default');
 }
 public function testAddTracksToPlaylist()
 {
     $mockResponse = (object) ['snapshot_id' => 'abc123'];
     $tracksToAdd = ['some:track:uri', 'some:other:track', 'some:third:track'];
     $this->apiStub->method('getSpotifyUserId')->willReturn('foo');
     $this->apiStub->expects($this->once())->method('addUserPlaylistTracks')->with('foo', 'playlistId', $tracksToAdd)->willReturn($mockResponse);
     $result = $this->playlistManager->addTracksToPlaylist('playlistId', $tracksToAdd);
     $this->assertTrue($result);
 }
 /**
  * @test
  *
  * @covers Pipedrive\Services\CacheProvider::register
  */
 public function shouldRegisterAppCache()
 {
     $this->serviceProvider->method('register')->willReturnCallback(function (Application $app) {
         $app['app.cache'] = $this->getMock(ArrayCache::class, [], [], '', false);
     });
     $app = new Application();
     $app->register($this->serviceProvider);
     $this->assertInstanceOf(ArrayCache::class, $app['app.cache']);
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->cacheContextsManager = $this->getMockBuilder('Drupal\\Core\\Cache\\Context\\CacheContextsManager')->disableOriginalConstructor()->getMock();
     $this->cacheContextsManager->method('assertValidTokens')->willReturn(TRUE);
     $container = new ContainerBuilder();
     $container->set('cache_contexts_manager', $this->cacheContextsManager);
     \Drupal::setContainer($container);
 }
Exemple #30
0
 /**
  * @dataProvider setUpdateOnlyProvider
  * @expectedException \UnexpectedValueException
  */
 public function testSetUpdateOnly($configNames, $existingData)
 {
     $this->systemConfig->expects($this->never())->method('setValue');
     $this->systemConfig->method('getValue')->with($configNames[0])->willReturn($existingData);
     $this->systemConfig->method('getKeys')->willReturn($existingData ? $configNames[0] : []);
     $this->consoleInput->expects($this->once())->method('getArgument')->with('name')->willReturn($configNames);
     $this->consoleInput->method('getOption')->will($this->returnValueMap([['value', 'foobar'], ['type', 'string'], ['update-only', true]]));
     $this->invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
 }