Skip to content

Commit

Permalink
Add tests for I18nShell option parser.
Browse files Browse the repository at this point in the history
Make sure the option parser calls don't raise exceptions and that the
expected subcommands exist.
  • Loading branch information
markstory committed Jan 28, 2016
1 parent 3056809 commit d267037
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions tests/TestCase/Shell/I18nShellTest.php
Expand Up @@ -50,11 +50,14 @@ public function tearDown()

$deDir = $this->localeDir . 'de_DE' . DS;

unlink($this->localeDir . 'default.pot');
unlink($this->localeDir . 'cake.pot');

unlink($deDir . 'default.po');
unlink($deDir . 'cake.po');
if (file_exists($this->localeDir . 'default.pot')) {
unlink($this->localeDir . 'default.pot');
unlink($this->localeDir . 'cake.pot');
}
if (file_exists($deDir . 'default.po')) {
unlink($deDir . 'default.po');
unlink($deDir . 'cake.po');
}
}

/**
Expand Down Expand Up @@ -90,4 +93,17 @@ public function testInit()
$this->assertFileExists($deDir . 'default.po');
$this->assertFileExists($deDir . 'cake.po');
}

/**
* Test that the option parser is shaped right.
*
* @return void
*/
public function testGetOptionParser()
{
$this->shell->loadTasks();
$parser = $this->shell->getOptionParser();
$this->assertArrayHasKey('init', $parser->subcommands());
$this->assertArrayHasKey('extract', $parser->subcommands());
}
}

0 comments on commit d267037

Please sign in to comment.