-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a semver file if using the SemVer task for the first time (#960)
* [FEATURE] Add SemVer unit test * [BUGFIX] Remove redundant check preventing file writes Remove the check that a given filename is writetable, since this requires the file to exist beforehand. We dont expect the file to exist however. Therefore this check should not be made or create a file if failing. Since this check is included in file_put_contents anyway we may remove the check safely. Closes #959
- Loading branch information
1 parent
f676455
commit bcbd8d5
Showing
2 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
namespace Robo; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Robo\Traits\TestTasksTrait; | ||
|
||
class SemVerTest extends TestCase | ||
{ | ||
use TestTasksTrait; | ||
use Task\Development\loadTasks; | ||
|
||
protected $fixtures; | ||
|
||
public function setUp() | ||
{ | ||
$this->fixtures = new Fixtures(); | ||
$this->initTestTasksTrait(); | ||
} | ||
|
||
public function tearDown() | ||
{ | ||
$this->fixtures->cleanup(); | ||
} | ||
|
||
public function testSemVerFileWrite() | ||
{ | ||
$this->fixtures->createAndCdToSandbox(); | ||
|
||
$sampleCss = $this->fixtures->dataFile('sample.css'); | ||
|
||
$outputFile = '.semver'; | ||
|
||
$result = $this->taskSemVer($outputFile) | ||
->increment() | ||
->run(); | ||
|
||
$this->assertTrue($result->wasSuccessful(), $result->getMessage()); | ||
|
||
$this->assertFileExists($outputFile); | ||
$outputFileContents = file_get_contents($outputFile); | ||
$this->assertContains('major', $outputFileContents, 'Semver file has expected structure'); | ||
} | ||
} |