Actualización

This commit is contained in:
Xes
2025-04-10 12:24:57 +02:00
parent 8969cc929d
commit 45420b6f0d
39760 changed files with 4303286 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace XApi\Repository\Api\Test\Functional;
use PHPUnit\Framework\TestCase;
use Xabbuh\XApi\Model\Activity;
use Xabbuh\XApi\Model\IRI;
use XApi\Repository\Api\ActivityRepositoryInterface;
/**
* @author Jérôme Parmentier <jerome.parmentier@acensi.fr>
*/
abstract class ActivityRepositoryTest extends TestCase
{
/**
* @var ActivityRepositoryInterface
*/
private $activityRepository;
protected function setUp()
{
$this->activityRepository = $this->createActivityRepository();
$this->cleanDatabase();
}
protected function tearDown()
{
$this->cleanDatabase();
}
/**
* @expectedException \Xabbuh\XApi\Common\Exception\NotFoundException
*/
public function testFetchingNonExistingActivityThrowsException()
{
$this->activityRepository->findActivityById(IRI::fromString('not-existing'));
}
/**
* @dataProvider getStatementsWithId
*/
public function testActivitiesCanBeRetrievedById(Activity $activity)
{
$fetchedActivity = $this->activityRepository->findActivityById($activity->getId());
$this->assertTrue($activity->equals($fetchedActivity));
}
public function getActivitiesWithId()
{
$fixtures = array();
foreach (get_class_methods('Xabbuh\XApi\DataFixtures\ActivityFixtures') as $method) {
$activity = call_user_func(array('Xabbuh\XApi\DataFixtures\ActivityFixtures', $method));
if ($activity instanceof Activity) {
$fixtures[$method] = array($activity);
}
}
return $fixtures;
}
abstract protected function createActivityRepository();
abstract protected function cleanDatabase();
}