updated-packages

This commit is contained in:
RafficMohammed
2023-01-08 00:13:22 +05:30
parent 3ff7df7487
commit da241bacb6
12659 changed files with 563377 additions and 510538 deletions

View File

@@ -9,22 +9,22 @@
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Gitonomy\Git\Tests;
use Gitonomy\Git\Exception\ReferenceNotFoundException;
use Gitonomy\Git\Reference\Branch;
use Gitonomy\Git\Reference\Tag;
class ReferenceTest extends AbstractTest
{
private $references;
/**
* @dataProvider provideEmpty
*/
public function testEmptyRepository($repository)
{
$this->assertCount(0, $repository->getReferences());
$this->assertEquals(array(), $repository->getReferences()->getAll());
$this->assertEquals([], $repository->getReferences()->getAll());
}
/**
@@ -34,7 +34,7 @@ class ReferenceTest extends AbstractTest
{
$branch = $repository->getReferences()->getBranch('master');
$this->assertTrue($branch instanceof Branch, 'Branch object is correct type');
$this->assertInstanceOf(Branch::class, $branch, 'Branch object is correct type');
$this->assertEquals($branch->getCommitHash(), $branch->getCommit()->getHash(), 'Hash is correctly resolved');
}
@@ -58,11 +58,12 @@ class ReferenceTest extends AbstractTest
/**
* @dataProvider provideFoobar
* @expectedException Gitonomy\Git\Exception\ReferenceNotFoundException
*/
public function testGetBranch_NotExisting_Error($repository)
{
$branch = $repository->getReferences()->getBranch('notexisting');
$this->expectException(ReferenceNotFoundException::class);
$repository->getReferences()->getBranch('notexisting');
}
/**
@@ -72,7 +73,8 @@ class ReferenceTest extends AbstractTest
{
$tag = $repository->getReferences()->getTag('0.1');
$this->assertTrue($tag instanceof Tag, 'Tag object is correct type');
$this->assertInstanceOf(Tag::class, $tag, 'Tag object is correct type');
$this->assertFalse($tag->isAnnotated(), 'Tag is not annotated');
$this->assertEquals(self::LONGFILE_COMMIT, $tag->getCommitHash(), 'Commit hash is correct');
$this->assertEquals(self::LONGFILE_COMMIT, $tag->getCommit()->getHash(), 'Commit hash is correct');
@@ -80,11 +82,38 @@ class ReferenceTest extends AbstractTest
/**
* @dataProvider provideFoobar
* @expectedException Gitonomy\Git\Exception\ReferenceNotFoundException
*/
public function testAnnotatedTag($repository)
{
$tag = $repository->getReferences()->getTag('annotated');
$this->assertInstanceOf(Tag::class, $tag, 'Tag object is correct type');
$this->assertTrue($tag->isAnnotated(), 'Tag is annotated');
$this->assertFalse($tag->isSigned(), 'Tag is not signed');
$this->assertEquals('Graham Campbell', $tag->getTaggerName(), 'Tagger name is correct');
$this->assertEquals('graham@alt-three.com', $tag->getTaggerEmail(), 'Tagger email is correct');
$this->assertEquals(1471428000, $tag->getTaggerDate()->getTimestamp(), 'Tag date is correct');
$this->assertEquals('heading', $tag->getSubjectMessage(), 'Message heading is correct');
$this->assertEquals("body\nbody", $tag->getBodyMessage(), 'Message body is correct');
$closure = function () {
return parent::getCommit();
};
$parentCommit = $closure->bindTo($tag, Tag::class);
$this->assertNotEquals($parentCommit()->getHash(), $tag->getCommit()->getHash(), 'Tag commit is not the same as main commit');
$this->assertEquals('fbde681b329a39e08b63dc54b341a3274c0380c0', $tag->getCommit()->getHash(), 'Tag commit is correct');
}
/**
* @dataProvider provideFoobar
*/
public function testGetTag_NotExisting_Error($repository)
{
$branch = $repository->getReferences()->getTag('notexisting');
$this->expectException(ReferenceNotFoundException::class);
$repository->getReferences()->getTag('notexisting');
}
/**
@@ -95,8 +124,8 @@ class ReferenceTest extends AbstractTest
$commit = $repository->getReferences()->getTag('0.1')->getCommit();
$resolved = $repository->getReferences()->resolve($commit->getHash());
$this->assertEquals(1, count($resolved), '1 revision resolved');
$this->assertTrue(reset($resolved) instanceof Tag, 'Resolved object is a tag');
$this->assertCount(1, $resolved, '1 revision resolved');
$this->assertInstanceOf(Tag::class, reset($resolved), 'Resolved object is a tag');
}
/**
@@ -107,8 +136,8 @@ class ReferenceTest extends AbstractTest
$commit = $repository->getReferences()->getTag('0.1')->getCommit();
$resolved = $repository->getReferences()->resolveTags($commit->getHash());
$this->assertEquals(1, count($resolved), '1 revision resolved');
$this->assertTrue(reset($resolved) instanceof Tag, 'Resolved object is a tag');
$this->assertCount(1, $resolved, '1 revision resolved');
$this->assertInstanceOf(Tag::class, reset($resolved), 'Resolved object is a tag');
}
/**
@@ -121,12 +150,12 @@ class ReferenceTest extends AbstractTest
$resolved = $repository->getReferences()->resolveBranches($master->getCommitHash());
if ($repository->isBare()) {
$this->assertEquals(1, count($resolved), '1 revision resolved');
$this->assertCount(1, $resolved, '1 revision resolved');
} else {
$this->assertEquals(2, count($resolved), '2 revision resolved');
$this->assertCount(2, $resolved, '2 revision resolved');
}
$this->assertTrue(reset($resolved) instanceof Branch, 'Resolved object is a branch');
$this->assertInstanceOf(Branch::class, reset($resolved), 'Resolved object is a branch');
}
/**
@@ -144,7 +173,7 @@ class ReferenceTest extends AbstractTest
{
$i = 0;
foreach ($repository->getReferences() as $ref) {
++$i;
$i++;
}
$this->assertGreaterThanOrEqual(2, $i, 'At least two references in repository');
}