Files
duckbrain-toolbox/tests/group6_release_test.php
T

34 lines
1.2 KiB
PHP

<?php
Harness::suite('group6-release');
Harness::it('release bumpea, commitea, tagea y publica', function () {
$repo = tmpdir('relrepo');
$origin = tmpdir('relorigin') . '/origin.git';
$script = dirname(__DIR__) . '/scripts/release';
git_init($repo);
exec('git init -q --bare ' . escapeshellarg($origin));
exec('git -C ' . escapeshellarg($repo) . ' remote add origin ' . escapeshellarg($origin));
write_file($repo . '/scripts/release', file_get_contents($script));
chmod($repo . '/scripts/release', 0755);
seed_package($repo, '1.2.3');
git_commit($repo, 'init');
exec('cd ' . escapeshellarg($repo) . ' && bash scripts/release http minor --yes', $out, $code);
eq(0, $code, 'release debe terminar bien: ' . implode("\n", $out));
$pushed = exec('git -C ' . escapeshellarg($repo) . ' tag -l "http-v1.3.0"');
eq('http-v1.3.0', $pushed, 'tag creado');
$remote = exec('git -C ' . escapeshellarg($origin) . ' tag -l "http-v1.3.0"');
eq('http-v1.3.0', $remote, 'tag publicado en origin');
$manifest = json_decode((string) file_get_contents($repo . '/packages/http/duckbrain.json'), true);
eq('1.3.0', $manifest['version']);
rrmdir($repo);
rrmdir(dirname($origin));
});