Skip to content

Commit

Permalink
fix: refactor code to make it compatible with latest pumukit II
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurujai committed Oct 31, 2024
1 parent 5af122a commit d42201b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Tests/Controller/IngestControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Doctrine\ODM\MongoDB\MongoDBException;
use Pumukit\CoreBundle\Tests\PumukitTestCase;
use Pumukit\EncoderBundle\Services\Repository\JobRepository;
use Pumukit\SchemaBundle\Document\MultimediaObject;
use Pumukit\SchemaBundle\Document\Person;
use Pumukit\SchemaBundle\Document\Role;
Expand All @@ -26,22 +27,22 @@ class IngestControllerTest extends PumukitTestCase
public const ENDPOINT_ADD_ATTACHMENT = '/api/ingest/addAttachment';

protected $dm;
private $jobService;
private $jobRepository;

public function setUp(): void
{
$options = ['environment' => 'test'];
static::bootKernel($options);
parent::setUp();
$this->jobService = static::$kernel->getContainer()->get('pumukitencoder.job');
$this->jobRepository = static::$kernel->getContainer()->get(JobRepository::class);
$this->dm = static::$kernel->getContainer()->get('doctrine_mongodb')->getManager();
}

public function tearDown(): void
{
parent::tearDown();
$this->dm->close();
$this->jobService = null;
$this->jobRepository = null;
gc_collect_cycles();
}

Expand Down Expand Up @@ -204,7 +205,7 @@ public function testAddTrack()
$mediaPackage = simplexml_load_string($client->getResponse()->getContent(), 'SimpleXMLElement', LIBXML_NOCDATA);
$multimediaObject = $this->dm->getRepository(MultimediaObject::class)->findOneBy(['_id' => (string) $mediaPackage['id']]);
$this->assertInstanceOf(MultimediaObject::class, $multimediaObject);
$jobs = $this->jobService->getNotFinishedJobsByMultimediaObjectId($multimediaObject->getId());
$jobs = $this->jobRepository->getNotFinishedJobsByMultimediaObjectId($multimediaObject->getId());
$count = 0;
foreach ($jobs as $job) {
++$count;
Expand Down Expand Up @@ -431,7 +432,7 @@ public function testAddMediaPackage()
}

// I can't check for tracks because the jobs haven't finished yet: $this->assertEquals(1, count($multimediaObject->getTracks()));
$jobs = $this->jobService->getNotFinishedJobsByMultimediaObjectId($multimediaObject->getId());
$jobs = $this->jobRepository->getNotFinishedJobsByMultimediaObjectId($multimediaObject->getId());
$i = 0;
foreach ($jobs as $job) {
++$i;
Expand Down

0 comments on commit d42201b

Please sign in to comment.