/**
  * Get the directory to use
  *
  * The --dir option takes priority over everything else;
  * then we convert the --namespace into a PSR-0 directory;
  * finally we use the default directory
  *
  * @param array     $details
  * @param Sanitizer $sanitizer  Instance of Sanitizer
  *
  * @return string
  */
 public function getDirectory($details, $sanitizer)
 {
     if (!empty($details['dir'])) {
         $dir = $details['dir'];
     } elseif (!empty($details['namespace'])) {
         $dir = $sanitizer->convertNamespaceToPath($details['namespace']);
     } else {
         $dir = 'app/Forms';
     }
     return $dir;
 }
 public function it_creates_the_correct_directory_when_namespace_given_but_no_dir(Sanitizer $sanitizer)
 {
     $sanitizer->convertNamespaceToPath('This\\Is\\The\\Test\\Namespace')->willReturn('This/Is/The/Test/Namespace');
     $details = ['namespace' => 'This\\Is\\The\\Test\\Namespace', 'dir' => '', 'className' => 'FooBar'];
     $this->getDirectory($details, $sanitizer)->shouldReturn('This/Is/The/Test/Namespace');
 }