Example #1
0
 public function saveProfile(Profile $profile, $overwrite = false)
 {
     $profileDir = $this->getProfileDir();
     $path = $this->getProfilePath($profile->getName());
     if (false === $overwrite && file_exists($path)) {
         throw new FileExistsException(sprintf('Profile already exists at "%s"', $path));
     }
     $yaml = Yaml::dump($profile->toArray());
     $this->filesystem->dumpFile($path, $yaml, 0600);
 }
Example #2
0
    public function it_should_save_a_given_profile(Profile $profile, Filesystem $filesystem)
    {
        $profile->getName()->willReturn('newprofile');
        $profile->toArray()->willReturn(array('transport' => array('name' => 'test_transport', 'option1' => 'value1'), 'phpcr' => array('username' => 'daniel', 'password' => 'leech')));
        $filesystem->dumpFile(Argument::type('string'), <<<EOT
transport:
    name: test_transport
    option1: value1
phpcr:
    username: daniel
    password: leech

EOT
, 0600)->shouldBeCalled();
        $this->saveProfile($profile);
    }
 protected function showProfile(OutputInterface $output, Profile $profile)
 {
     $output->writeln(sprintf('<comment>Using profile "%s"</comment>', $profile->getName()));
 }