Skip to content

Commit

Permalink
Fixing blank line where shebang line used to be.
Browse files Browse the repository at this point in the history
  • Loading branch information
kherge committed Dec 3, 2014
1 parent 9ed2459 commit b55dceb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/lib/Herrera/Box/StubGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,13 @@ public function intercept($intercept)
public function generate()
{
$stub = array();

if ('' !== $this->shebang) {
$stub[] = $this->shebang;
}

$stub[] = '<?php';

$stub = array($this->shebang, '<?php');

if (null !== $this->banner) {
$stub[] = $this->getBanner();
}
Expand Down
30 changes: 28 additions & 2 deletions src/tests/Herrera/Box/Tests/StubGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ public function testGenerateExtractForced()
->notFound('not_found.php')
->rewrite('rewrite');

$phps = Phar::PHPS;

$this->assertEquals(
<<<STUB
#!/usr/bin/env php
Expand Down Expand Up @@ -238,6 +236,34 @@ public function testGenerateMap()
);
}

/**
* @depends testGenerate
*/
public function testGenerateNoShebang()
{
$this
->generator
->alias('test.phar')
->shebang('');

$this->assertEquals(
<<<STUB
<?php
/**
* Generated by Box.
*
* @link https://github.com/herrera-io/php-box/
*/
if (class_exists('Phar')) {
Phar::mapPhar('test.phar');
}
__HALT_COMPILER();
STUB
,
$this->generator->generate()
);
}

public function testMimetypes()
{
$map = array('php' => Phar::PHPS);
Expand Down

0 comments on commit b55dceb

Please sign in to comment.