| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * This file is part of the GitElephant package. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * (c) Matteo Giachino <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * For the full copyright and license information, please view the LICENSE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * file that was distributed with this source code. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * Just for fun... | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | namespace GitElephant\Objects; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use \GitElephant\TestCase; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use \GitElephant\Objects\Commit; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use \GitElephant\Command\ShowCommand; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | use \GitElephant\Command\MainCommand; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | use \GitElephant\Command\CommandContainer; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  * CommitTest | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  * @author Matteo Giachino <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | class CommitTest extends TestCase | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |      * @var \GitElephant\Objects\Commit; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     private $commit; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |     public function setUp() | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |         $this->initRepository(); | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |         $mainCommand = new MainCommand(); | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |         $this->getCaller()->execute($mainCommand->init()); | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |         $this->addFile('foo'); | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |         $this->getCaller()->execute($mainCommand->add()); | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |         $this->getCaller()->execute($mainCommand->commit('first commit')); | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |      * commit tests | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     public function testCommit() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |         $showCommand = new ShowCommand(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         $this->commit = Commit::pick($this->getRepository()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |         $this->assertInstanceOf('\GitElephant\Objects\Commit', $this->commit); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         $this->assertInstanceOf('\GitElephant\Objects\Author', $this->commit->getAuthor()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         $this->assertInstanceOf('\GitElephant\Objects\Author', $this->commit->getCommitter()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         $this->assertInstanceOf('\Datetime', $this->commit->getDatetimeAuthor()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         $this->assertInstanceOf('\Datetime', $this->commit->getDatetimeCommitter()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         $this->assertInstanceOf('\GitElephant\Objects\Commit\Message', $this->commit->getMessage()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         $this->assertEquals('first commit', $this->commit->getMessage()->toString()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         $this->assertRegExp('/^\w{40}$/', $this->commit->getSha()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |         $this->assertEquals(array(), $this->commit->getParents()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         $this->addFile('foo2'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         $mainCommand = new MainCommand(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |         $this->getCaller()->execute($mainCommand->add()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |         $this->getCaller()->execute($mainCommand->commit('second commit')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         $this->getCaller()->execute($showCommand->showCommit('HEAD')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |         $this->commit = Commit::pick($this->getRepository()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |         $parents = $this->commit->getParents(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         $this->assertRegExp('/^\w{40}$/', $parents[0]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |      * constructor regex test | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     public function testCommitRegEx() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         $outputLines = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |             "commit c277373174aa442af12a8e59de1812f3472c15f5", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |             "tree 9d36a2d3c5d5bce9c6779a574ed2ba3d274d8016", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |             "author matt <[email protected]> 1326214449 +0100", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |             "committer matt <[email protected]> 1326214449 +0100", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |             "", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |             "    first commit" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |         $mockRepo = $this->getMockRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |         $this->addOutputToMockRepo($mockRepo, $outputLines); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |         $commit = Commit::pick($mockRepo); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |         $committer = $commit->getCommitter(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |         $author = $commit->getAuthor(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         $this->assertEquals('matt', $committer->getName()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |         $this->assertEquals('matt', $author->getName()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |         $outputLines = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |             "commit c277373174aa442af12a8e59de1812f3472c15f5", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |             "tree 9d36a2d3c5d5bce9c6779a574ed2ba3d274d8016", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |             "author matt jack <[email protected]> 1326214449 +0100", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |             "committer matt jack <[email protected]> 1326214449 +0100", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |             "", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |             "    first commit" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |         $mockRepo = $this->getMockRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |         $this->addOutputToMockRepo($mockRepo, $outputLines); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |         $commit = Commit::pick($mockRepo); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |         $this->doCommitTest( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |             $commit, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |             'c277373174aa442af12a8e59de1812f3472c15f5', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |             '9d36a2d3c5d5bce9c6779a574ed2ba3d274d8016', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |             'matt jack', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |             'matt jack', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |             '[email protected]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |             '[email protected]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |             '1326214449', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |             '1326214449', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |             'first commit' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |      * testCommitDate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |     public function testCommitDate() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |         $outputLines = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |             "commit c277373174aa442af12a8e59de1812f3472c15f5", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |             "tree c277373174aa442af12a8e59de1812f3472c15f6", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |             "author John Doe <[email protected]> 1326214449 +0100", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |             "committer Jack Doe <[email protected]> 1326214449 +0100", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |             "", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |             "    First commit" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |         $mockRepo = $this->getMockRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |         $this->addOutputToMockRepo($mockRepo, $outputLines); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |         $commit = Commit::pick($mockRepo); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |         $this->doCommitTest( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |             $commit, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |             'c277373174aa442af12a8e59de1812f3472c15f5', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |             'c277373174aa442af12a8e59de1812f3472c15f6', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |             'John Doe', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |             'Jack Doe', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |             '[email protected]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |             '[email protected]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |             '1326214449', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |             '1326214449', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |             'First commit' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |      * testCreateFromOutputLines | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |     public function testCreateFromOutputLines() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |         $outputLines = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |             "commit c277373174aa442af12a8e59de1812f3472c15f5", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |             "tree 9d36a2d3c5d5bce9c6779a574ed2ba3d274d8016", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |             "author John Doe <[email protected]> 1326214000 +0100", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |             "committer Jack Doe <[email protected]> 1326214100 +0100", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |             "", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |             "    Initial commit" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |         $commit = Commit::createFromOutputLines($this->getRepository(), $outputLines); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |         $this->doCommitTest( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |             $commit, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |             'c277373174aa442af12a8e59de1812f3472c15f5', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |             '9d36a2d3c5d5bce9c6779a574ed2ba3d274d8016', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |             'John Doe', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |             'Jack Doe', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |             '[email protected]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |             '[email protected]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |             '1326214000', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |             '1326214100', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |             'Initial commit' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |      * testCreate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |     public function testCreate() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |         $this->getRepository()->init(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |         $this->addFile('test'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |         $this->repository->stage(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |         $commit = Commit::create($this->repository, 'first commit', true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |         $this->assertEquals($commit, $this->repository->getCommit()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |      * testGetDiff | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |     public function testGetDiff() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |         $this->getRepository()->init(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |         $this->addFile('test'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |         $this->repository->stage(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |         $commit = Commit::create($this->repository, 'first commit', true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |         $diff = $commit->getDiff(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |         $this->assertInstanceOf('GitElephant\Objects\Diff\Diff', $diff); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |         $this->assertCount(1, $diff); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |         $this->addFile('test2'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |         $this->addFile('test3'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |         $this->repository->stage(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |         $commit = Commit::create($this->repository, 'second commit', true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |         $diff = $commit->getDiff(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |         $this->assertInstanceOf('GitElephant\Objects\Diff\Diff', $diff); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |         $this->assertCount(2, $diff); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |     public function testRevParse() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |         $this->getRepository()->init(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |         $this->addFile('test'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |         $this->repository->stage(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |         $commit = Commit::create($this->repository, 'first commit', true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |         $revParse = $commit->revParse(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |         $this->assertEquals($commit->getSha(), $revParse[0]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |     public function testCommitWithoutTag() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |         $this->getRepository()->init(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |         $this->addFile('test'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |         $this->repository->stage(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |         $commit = Commit::create($this->repository, 'first commit', true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |         $this->assertFalse($commit->tagged()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |     public function testCommitWithTag() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |         $this->getRepository()->init(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |         $this->addFile('test'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |         $this->repository->stage(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |         $commit = Commit::create($this->repository, 'first commit', true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |         Tag::create($this->repository, '1.0.0'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |         $this->assertTrue($commit->tagged()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |         $this->assertCount(1, $commit->getTags()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |         $commitTags = $commit->getTags(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |         $this->assertEquals('1.0.0', $commitTags[0]->getName()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 249 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 250 |  |  |  |