Bart\Git\CommitTest::getStubCommit PHP Method

getStubCommit() public static method

Utility method to create a stub Commit for any tests that need one Custom expectations can be set via the $configure parameter
public static getStubCommit ( Bart\BaseTestCase $phpu, string $revision = 'HEAD', callable $configure = null ) : Commit
$phpu Bart\BaseTestCase
$revision string
$configure callable Shmock configuration function
return Commit
    public static function getStubCommit(BaseTestCase $phpu, $revision = 'HEAD', callable $configure = null)
    {
        return $phpu->shmock('\\Bart\\Git\\Commit', function ($commit) use($revision, $configure) {
            $commit->disable_original_constructor();
            $commit->__toString()->any()->return_value($revision);
            $commit->revision()->any()->return_value($revision);
            if ($configure) {
                $configure($commit);
            }
        });
    }

Usage Example

Beispiel #1
0
 public function setUp()
 {
     parent::setUp();
     $this->head = CommitTest::getStubCommit($this, $this->commitHash, function ($commit) {
         $commit->gerritChangeId()->once()->return_value($this->changeId);
     });
 }
All Usage Examples Of Bart\Git\CommitTest::getStubCommit