From 05f8560b5637c613fd989aeb889ba0f4950cde95 Mon Sep 17 00:00:00 2001 From: Ashur Cabrera Date: Sat, 12 Aug 2017 14:12:40 -0700 Subject: [PATCH] added 'show' command tests --- test/commands/showTest.php | 70 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 test/commands/showTest.php diff --git a/test/commands/showTest.php b/test/commands/showTest.php new file mode 100644 index 0000000..73ca9cf --- /dev/null +++ b/test/commands/showTest.php @@ -0,0 +1,70 @@ +usePugfile( '.pug-enabled' ); + $result = $this->executePugCommand( 'show' ); + + $this->assertEquals( 0, $result['exit'] ); + + $expectedOutput = <<assertEquals( $expectedOutput, $result['output'] ); + } + + public function testShowEmptyPugfileReturnsError() + { + $this->usePugfile( '.pug-new' ); + $result = $this->executePugCommand( 'show' ); + + $this->assertEquals( 0, $result['exit'] ); + $this->assertEquals( "pug: Not tracking any projects. See 'pug help'", $result['output'] ); + } + + public function testShowUnknownProjectReturnsError() + { + $this->usePugfile( '.pug-new' ); + + $targetName = microtime( true ); + $result = $this->executePugCommand( 'show', [$targetName] ); + + $this->assertEquals( 1, $result['exit'] ); + $this->assertEquals( "pug: Unknown project or directory '{$targetName}'.", $result['output'] ); + } + + public function testShowSingleProjectReturnsListing() + { + $this->usePugfile( '.pug-enabled' ); + $result = $this->executePugCommand( 'show', ['pug/1'] ); + + $this->assertSame( 0, $result['exit'] ); + $this->assertSame( 0, strpos( $result['output'], '* pug/1' ) ); + $this->assertSame( false, strpos( $result['output'], '* pug/2' ) ); + } + + public function testShowGroupReturnsListing() + { + $this->markTestIncomplete(); + + $this->usePugfile( '.pug-groups' ); + $result = $this->executePugCommand( 'show', ['red'] ); + + $this->assertSame( 0, $result['exit'] ); + $this->assertTrue( strpos( $result['output'], '* red/1' ) >= 0 ); + $this->assertTrue( strpos( $result['output'], '* red/2' ) >= 0 ); + $this->assertFalse( strpos( $result['output'], '* green/1' ) >= 0 ); + } +}