Indefero

Indefero Commit Details


Date:2011-04-13 17:48:36 (13 years 8 months ago)
Author:Thomas Keller
Branch:develop, feature-issue_links, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, release-1.2, release-1.3
Commit:b3368071ac07dc321f60cd0cc0c2a34c584a6927
Parents: 67b80ee11c3184ca54dfa725b0249e20942a7d48
Message:Continue with the mtn interface tests

- test getRepositorySize() with a test file
- implement tests for inTags(), inBranches(), getFile(),
getCommit() and getExtraProperties()
- mark the static methods as untestable
Changes:

File differences

src/IDF/Scm/Monotone.php
668668
669669
670670
671
671
672672
673673
674674
......
676676
677677
678678
679
679680
680681
681682
{
$revs = $this->_resolveSelector($commit);
if (count($revs) == 0)
return array();
return false;
$res = array();
$res['parents'] = preg_split("/\n/", $parents, -1, PREG_SPLIT_NO_EMPTY);
$certs = $this->_getCerts($revs[0]);
// FIXME: this assumes that author, date and changelog are always given
$res['author'] = implode(', ', $certs['author']);
test/IDF/Scm/MonotoneTest.php
5353
5454
5555
56
56
5757
5858
5959
......
6161
6262
6363
64
64
6565
6666
6767
......
8989
9090
9191
92
92
93
94
95
9396
9497
9598
......
139142
140143
141144
142
143
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
144167
145168
146169
......
171194
172195
173196
174
175
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
176225
177226
178227
......
183232
184233
185234
186
235
187236
188237
189238
190239
191
192
240
193241
194242
195243
196244
197
198
245
199246
200247
201248
202249
203
250
204251
205252
206253
......
301348
302349
303350
304
351
305352
306353
307354
......
334381
335382
336383
384
337385
338386
339387
......
386434
387435
388436
389
390
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
391456
392457
393458
......
398463
399464
400465
401
402
403
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
404535
405536
406537
407538
408
409
539
540
541
542
543
544
545
546
410547
411548
412549
public function getLastOutOfBandOutput() {}
}
class IDF_Scm_Monotone_Test extends PHPUnit_Framework_TestCase
class IDF_Scm_MonotoneTest extends PHPUnit_Framework_TestCase
{
private $proj = null;
{
$this->proj = new IDF_Project();
$this->proj->id = 1;
$this->proj->name = $this->proj->shortname = 'Test';
$this->proj->name = $this->proj->shortname = 'test';
$this->proj->create();
$this->proj->getConf()->setVal('mtn_master_branch', 'master.branch');
public function testGetRepositorySize()
{
$this->markTestSkipped('Cannot mock real repository file');
$repodir = DATADIR.'/'.__CLASS__.'/%s.mtn';
$GLOBALS['_PX_config']['mtn_repositories'] = $repodir;
$instance = $this->createMock();
$this->assertEquals(335872, $instance->getRepositorySize());
}
public function testIsAvailable()
public function testInBranches()
{
// returns the branches the given commit is in
$this->markTestIncomplete();
$instance = $this->createMock();
$stdio = "4567890123456789012345678901234567890123\n";
$instance->getStdio()->setExpectedOutput(array('select', '456'), array(), $stdio);
$stdio =<<<END
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "branch"
value "main.branch"
trust "trusted"
key [aea5d3716d31281171aaecf3a7c227e5545b0504]
signature "ok"
name "branch"
value "feature.branch"
trust "trusted"
END;
$instance->getStdio()->setExpectedOutput(array('certs', '4567890123456789012345678901234567890123'), array(), $stdio);
$out = $instance->inBranches('456', null);
$this->assertEquals(array('h:main.branch', 'h:feature.branch'), $out);
}
public function testGetTags()
public function testInTags()
{
// returns the tags that are attached to the given commit
$this->markTestIncomplete();
$instance = $this->createMock();
$stdio = "3456789012345678901234567890123456789012\n";
$instance->getStdio()->setExpectedOutput(array('select', '345'), array(), $stdio);
$stdio =<<<END
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "tag"
value "release-1.0rc"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "tag"
value "release-1.0"
trust "trusted"
key [aea5d3716d31281171aaecf3a7c227e5545b0504]
signature "ok"
name "tag"
value "release-1.0"
trust "trusted"
END;
$instance->getStdio()->setExpectedOutput(array('certs', '3456789012345678901234567890123456789012'), array(), $stdio);
$out = $instance->inTags('345', null);
$this->assertEquals(array('t:release-1.0rc', 't:release-1.0'), $out);
}
public function testGetTree()
public function testFindAuthor()
{
$this->markTestSkipped('This functionality here should reside in IDF_Scm');
$this->markTestSkipped('code under test should reside in IDF_Scm');
}
public function testGetAnonymousAccessUrl()
{
// test the generation of the anonymous remote URL
$this->markTestIncomplete();
$this->markTestSkipped('cannot test this static method');
}
public function testGetAuthAccessUrl()
{
// test the generation of the authenticated remote URL (only really visible for SSH)
$this->markTestIncomplete();
$this->markTestSkipped('cannot test this static method');
}
public function testFactory()
{
$this->markTestSkipped('Cannot mock real repository');
$this->markTestSkipped('cannot test this static method');
}
public function testValidateRevision()
$this->assertFalse($instance->getPathInfo('foo', 't:123'));
//
// existing file file
// existing file
//
$stdio =<<<END
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
$file = $instance->getPathInfo('doc/AUTHORS', 't:123');
$this->assertEquals('doc/AUTHORS', $file->fullpath);
$this->assertEquals('doc/AUTHORS', $file->efullpath);
$this->assertEquals('de9ed2fffe2e8c0094bf51bb66d1c1ff2deeaa03', $file->hash);
$this->assertEquals('AUTHORS', $file->file);
$this->assertEquals('blob', $file->type);
$this->assertEquals(17024, $file->size);
public function testGetFile()
{
// test cmd_only and full file fetching
$this->markTestIncomplete();
$instance = $this->createMock();
$thrown = false;
try
{
$instance->getFile(null, true);
}
catch (Pluf_Exception_NotImplemented $e)
{
$thrown = true;
}
$this->assertTrue($thrown);
$stdio = 'Foobar';
$instance->getStdio()->setExpectedOutput(array('get_file', '1234567890123456789012345678901234567890'), array(), $stdio);
$obj = new stdClass();
$obj->hash = '1234567890123456789012345678901234567890';
$this->assertEquals('Foobar', $instance->getFile($obj));
}
public function testGetChanges()
public function testGetCommit()
{
// test get commit information with and without a diff text
// test multiple branches, dates, authors, aso
$this->markTestIncomplete();
$instance = $this->createMock();
$this->assertFalse($instance->getCommit('t:234'));
$stdio = "2345678901234567890123456789012345678901\n";
$instance->getStdio()->setExpectedOutput(array('select', 't:234'), array(), $stdio);
$stdio = "1234567890123456789012345678901234567891\n".
"1234567890123456789012345678901234567892\n";
$instance->getStdio()->setExpectedOutput(array('parents', '2345678901234567890123456789012345678901'), array(), $stdio);
$stdio =<<<END
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "author"
value "me@thomaskeller.biz"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "author"
value "graydon@pobox.com"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "branch"
value "main.branch"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "branch"
value "feature.branch"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "changelog"
value "something changed"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "changelog"
value "something changed here as
well, unbelievable!"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "date"
value "2011-03-19T13:59:47"
trust "trusted"
END;
$instance->getStdio()->setExpectedOutput(array('certs', '2345678901234567890123456789012345678901'), array(), $stdio);
$commit = $instance->getCommit('t:234');
$this->assertEquals('2345678901234567890123456789012345678901', $commit->commit);
$this->assertEquals(array('1234567890123456789012345678901234567891',
'1234567890123456789012345678901234567892'),
$commit->parents);
$this->assertEquals('me@thomaskeller.biz, graydon@pobox.com', $commit->author);
$this->assertEquals('2011-03-19 13:59:47', $commit->date);
$this->assertEquals('something changed', $commit->title);
$this->assertEquals("---\nsomething changed here as\nwell, unbelievable!", $commit->full_message);
$this->assertEquals('main.branch, feature.branch', $commit->branch);
$this->assertEquals('', $commit->diff);
}
public function testGetExtraProperties()
{
// test array('parents' => array(rev1, rev2, ...)) or array() if root revision
$this->markTestIncomplete();
$instance = $this->createMock();
$this->assertEquals(array(), $instance->getExtraProperties(new stdClass()));
$cobj = (object) array('parents' => array('1234567890123456789012345678901234567891'));
$this->assertEquals(array('parents' => array('1234567890123456789012345678901234567891')),
$instance->getExtraProperties($cobj));
}
public function testIsCommitLarge()

Archive Download the corresponding diff file

Page rendered in 0.09622s using 13 queries.