Skip to content

Commit

Permalink
resolve build issues
Browse files Browse the repository at this point in the history
Signed-off-by: Devlin Junker <devlin.junker@gmail.com>
  • Loading branch information
devlinjunker committed Aug 7, 2023
1 parent 12189db commit fbabb64
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function index(): TemplateResponse
$csp->addAllowedImageDomain('*')
->addAllowedMediaDomain('*')
->addAllowedConnectDomain('*')// chrome breaks on audio elements
->allowEvalScript(true)
// ->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 fbabb64

Please sign in to comment.