コード例 #1
0
 /**
  * Test getter.
  */
 public function testGet()
 {
     $manager = new PairStorage($this->manager);
     // This item must exist in db.
     $pair_value = $manager->get('name0');
     $this->assertEquals('will not be here', $pair_value);
     // This item is not existing.
     $pair_value = $manager->get('name13');
     $this->assertEquals(null, $pair_value);
 }
コード例 #2
0
 /**
  * Test ongr:sync:provide:parameter behavior.
  */
 public function testCommand()
 {
     $parameter = 'winner';
     $parameterValue = 'Red Viper';
     $parameterNewValue = 'The Mountain';
     $this->pairStorage->expects($this->once())->method('get')->with($this->equalTo($parameter))->willReturn($parameterValue);
     $this->pairStorage->expects($this->once())->method('set')->with($this->equalTo($parameter), $this->equalTo($parameterNewValue));
     $container = new ContainerBuilder();
     $container->set('ongr_connections.pair_storage', $this->pairStorage);
     $command = new SyncParametersCommand();
     $command->setContainer($container);
     $application = new Application();
     $application->add($command);
     $commandForTesting = $application->find('ongr:sync:provide:parameter');
     $commandTester = new CommandTester($commandForTesting);
     $commandTester->execute(['command' => $command->getName(), 'parameter' => $parameter, '--set' => $parameterNewValue]);
     $this->assertContains('New value written: \'The Mountain\'', $commandTester->getDisplay());
 }