-
-
Save muhamed-didovic/28ab32b1562c7c701fcb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
# ignore | |
use \Way\Console\Guardfile; | |
use Mockery as m; | |
class GuardfileTest extends \PHPUnit_Framework_TestCase { | |
public function testCanOverrideDefaultPath() | |
{ | |
$file = m::mock('Illuminate\Filesystem\Filesystem'); | |
$guardFile = new Guardfile($file, 'foo/bar'); | |
# When we need to inspect private properties, | |
# let's use a helper method. | |
$pathProperty = $this->makePublic($guardFile, 'path'); | |
# Use getValue($instance) to fetch the value of the prop. | |
$this->assertEquals('foo/bar', $pathProperty->getValue($guardFile)); | |
} | |
protected function makePublic($obj, $property) | |
{ | |
$reflect = new \ReflectionObject($obj); | |
$property = $reflect->getProperty($property); | |
$property->setAccessible(true); | |
return $property; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment