예제 #1
0
 public function testCorrectOutput()
 {
     $result = array(new ShellResult(0, 'dev-awesome-feat' . PHP_EOL . 'dev-awful-feat' . PHP_EOL, ''));
     $mockExecutor = new MockCommandExecutor(new MockCommandBuilder($result, '/usr/bin/svn'));
     $meta = new Meta($mockExecutor, new RepositoryConfig('trunk', 'branches', 'tags'));
     $actualBranchList = $meta->getAllBranches();
     $this->assertEquals(array(new Branch('trunk'), new Branch('dev-awesome-feat'), new Branch('dev-awful-feat')), $actualBranchList);
 }
예제 #2
0
 public function testCorrectArguments()
 {
     $results = array(new ShellResult(0, file_get_contents(realpath(__DIR__ . '/data/svn_info_local.xml')), ''), new ShellResult(0, file_get_contents(realpath(__DIR__ . '/data/svn_info_remote.xml')), ''), new ShellResult(0, file_get_contents(realpath(__DIR__ . '/data/svn_log_local.xml')), ''), new ShellResult(0, file_get_contents(realpath(__DIR__ . '/data/svn_log_remote.xml')), ''));
     $mockExecutor = new MockCommandExecutor(new MockCommandBuilder($results, '/usr/bin/svn'));
     $meta = new Meta($mockExecutor, new RepositoryConfig());
     $revision = $meta->getLatestRevision();
     $this->assertEquals(array(array('info', '--xml'), array('info', 'http://svn.example.com/myproject/branches/1.0', '--xml'), array('log', '-r', '1645938', '--xml'), array('log', '-r', '1645938', '--xml', 'http://svn.example.com/myproject/branches/1.0')), $mockExecutor->getArguments());
     $this->assertEquals(new RevisionLog('1645938', 'brian', \DateTime::createFromFormat('Y-m-d\\TH:i:s.u\\Z', '2014-12-16T13:55:25.549151Z'), 'Update: move foo out of bar to make way for baz.'), $revision);
 }
예제 #3
0
 public function testCorrectArgumentsAndOutput()
 {
     $results = array(new ShellResult(0, file_get_contents(realpath(__DIR__ . '/data/svn_log.xml')), ''));
     $mockExecutor = new MockCommandExecutor(new MockCommandBuilder($results, '/usr/bin/svn'));
     $meta = new Meta($mockExecutor, new RepositoryConfig('trunk', 'branches', 'tags'));
     $revisions = $meta->getAllRevisionLogs();
     $this->assertEquals(array(array('log', '--xml')), $mockExecutor->getArguments());
     $this->assertEquals(array(new RevisionLog('1645937', 'brian', \DateTime::createFromFormat('Y-m-d\\TH:i:s.u\\Z', '2014-12-16T13:07:03.507023Z'), 'Fixed: the problem with the thing.'), new RevisionLog('1645938', 'brian', \DateTime::createFromFormat('Y-m-d\\TH:i:s.u\\Z', '2014-12-16T13:55:25.549151Z'), 'Update: move foo out of bar to make way for baz.')), $revisions);
 }
예제 #4
0
 public function testCorrectOutput()
 {
     $resultList = $this->getMockResultList();
     $mockExecutor = new MockCommandExecutor(new MockCommandBuilder($resultList, '/usr/bin/svn'));
     $meta = new Meta($mockExecutor, new RepositoryConfig('trunk', 'branches', 'tags'));
     $actualTagList = $meta->getAllTags();
     $this->assertEquals(array(new Tag('v0.9.0', new RevisionLog('547', 'colm', new \DateTime('2014-01-08T11:45:43.126845Z'), 'Generated doc changes')), new Tag('v0.9.1', new RevisionLog('612', 'wrowe', new \DateTime('2014-05-15T07:36:29.748798Z'), 'Fix the FooWidget')), new Tag('v1.0.0', new RevisionLog('834', 'bob', new \DateTime('2014-10-09T05:58:19.000000Z'), 'Rework the BarWidget to be Baz-compliant'))), $actualTagList);
     $this->assertInstanceOf('\\ptlis\\Vcs\\Shared\\RevisionLog', $actualTagList[0]->getRevisionLog());
     $this->assertEquals('v0.9.0', $actualTagList[0]->getName());
 }
예제 #5
0
 public function testCorrectOutputBranch()
 {
     $result = array(new ShellResult(0, 'trunk' . PHP_EOL, ''));
     $mockExecutor = new MockCommandExecutor(new MockCommandBuilder($result, '/usr/bin/svn'));
     $branch = 'trunk';
     $meta = new Meta($mockExecutor, new RepositoryConfig('trunk', 'branches', 'tags'), $branch);
     $actualBranch = $meta->getCurrentBranch();
     $this->assertEquals(new Branch($branch), $actualBranch);
     $this->assertEquals($branch, $actualBranch->getName());
     $this->assertEquals($branch, $actualBranch);
 }
예제 #6
0
 public function testCorrectArguments()
 {
     $builder = new MockCommandBuilder();
     $builder = $builder->setCommand('/usr/bin/svn')->addMockResult(0, file_get_contents(__DIR__ . '/data/svn_diff'), '');
     $mockExecutor = new MockCommandExecutor($builder);
     $meta = new Meta($mockExecutor, new RepositoryConfig());
     $revision = $meta->getRevision(new RevisionLog('1695913', 'mrumph', new \DateTime('2015-08-14 14:51:38 +0100'), 'Clarify RewriteRule example in mod_proxy doc'));
     $this->assertEquals(array(array('diff', '-c', '1695913')), $mockExecutor->getArguments());
     $this->assertInstanceOf('\\ptlis\\Vcs\\Shared\\Revision', $revision);
     $this->assertInstanceOf('\\ptlis\\Vcs\\Shared\\RevisionLog', $revision->getLog());
     $this->assertInstanceOf('\\ptlis\\DiffParser\\Changeset', $revision->getChangeset());
 }
예제 #7
0
 public function testCorrectArgumentsAndOutput()
 {
     $results = array(new ShellResult(0, file_get_contents(realpath(__DIR__ . '/data/svn_log_single.xml')), ''));
     $mockExecutor = new MockCommandExecutor(new MockCommandBuilder($results, '/usr/bin/svn'));
     $meta = new Meta($mockExecutor, new RepositoryConfig());
     $actualRevision = $meta->getRevisionLog('1645938');
     $this->assertEquals(array(array('log', '-r', '1645938', '--xml')), $mockExecutor->getArguments());
     $expectedRevision = new RevisionLog('1645938', 'brian', \DateTime::createFromFormat('Y-m-d\\TH:i:s.u\\Z', '2014-12-16T13:55:25.549151Z'), 'Update: move foo out of bar to make way for baz.');
     $this->assertEquals($expectedRevision, $actualRevision);
     // Check getters
     $this->assertEquals($expectedRevision->getIdentifier(), $actualRevision->getIdentifier());
     $this->assertEquals($expectedRevision->getCreated(), $actualRevision->getCreated());
     $this->assertEquals($expectedRevision->getAuthor(), $actualRevision->getAuthor());
     $this->assertEquals($expectedRevision->getMessage(), $actualRevision->getMessage());
 }