Skip to content

Commit

Permalink
resolve build issues
Browse files Browse the repository at this point in the history
Signed-off-by: Devlin Junker <[email protected]>
  • Loading branch information
devlinjunker authored and Grotax committed Aug 9, 2023
1 parent eeb0638 commit b9a5887
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
1 change: 0 additions & 1 deletion lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public function index(): TemplateResponse
$csp->addAllowedImageDomain('*')
->addAllowedMediaDomain('*')
->addAllowedConnectDomain('*')// chrome breaks on audio elements
->allowEvalScript(true)
->addAllowedFrameDomain('https://youtube.com')
->addAllowedFrameDomain('https://www.youtube.com')
->addAllowedFrameDomain('https://player.vimeo.com')
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/FolderServiceV2.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function rename(string $userId, int $folderId, string $newName): Entity
public function markDelete(string $userId, int $folderId, bool $mark): Entity
{
$folder = $this->find($userId, $folderId);
$time = $mark ? $this->timeFactory->getTime() : 0;
$time = $mark ? $this->timeFactory->now()->getTimestamp() : 0;
$folder->setDeletedAt($time);

return $this->mapper->update($folder);
Expand Down
27 changes: 24 additions & 3 deletions tests/Unit/Service/FolderServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,34 @@ class FolderServiceTest extends TestCase
protected function setUp(): void
{
$this->time = 222;
$timeFactory = $this->getMockBuilder(TimeFactory::class)
->disableOriginalConstructor()
->getMock();

$timeFactoryBuilder = $this->getMockBuilder(TimeFactory::class)
->disableOriginalConstructor();

// HACK: due to differences in NC26 and NC 27
if (!method_exists(TimeFactory::class, 'now')) {
$timeFactoryBuilder->addMethods(['now'])
->onlyMethods(['getTime']);
} else if(!method_exists(TimeFactory::class, 'getTime')) {
$timeFactoryBuilder->addMethods(['getTime']);
}

$timeFactory = $timeFactoryBuilder->getMock();
$timeFactory->expects($this->any())
->method('getTime')
->will($this->returnValue($this->time));

$mockDateTime = $this->getMockBuilder(\DateTimeImmutable::class)
->disableOriginalConstructor()
->getMock();
$mockDateTime->expects($this->any())
->method('getTimestamp')
->will($this->returnValue($this->time));

$timeFactory->expects($this->any())
->method('now')
->will($this->returnValue($mockDateTime));

$this->feedService = $this->getMockBuilder(FeedServiceV2::class)
->disableOriginalConstructor()
->getMock();
Expand Down

0 comments on commit b9a5887

Please sign in to comment.