Skip to content

Commit

Permalink
Fix tests (#1527)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet authored Aug 7, 2022
1 parent 37ce8fd commit c7b1889
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
33 changes: 17 additions & 16 deletions tests/CmsManager/CmsPageManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ public function testGetPageWithUrl(): void
{
$pageManager = $this->createMock(PageManagerInterface::class);

$pageManager->method('findOneBy')->willReturn(new Page());
$page = new Page();
$page->setId(42);
$pageManager->method('findOneBy')->willReturn($page);
$this->blockInteractor->method('loadPageBlocks')->willReturn([]);

$manager = $this->createManager($pageManager, $this->blockInteractor);

$page = '/test';
$site = new Site();

static::assertInstanceOf(PageInterface::class, $manager->getPage($site, $page));
static::assertInstanceOf(PageInterface::class, $manager->getPage($site, '/test'));
}

/**
Expand Down Expand Up @@ -138,15 +138,15 @@ public function testGetPageWithRouteName(): void
{
$pageManager = $this->createMock(PageManagerInterface::class);

$pageManager->method('findOneBy')->willReturn(new Page());
$page = new Page();
$page->setId(42);
$pageManager->method('findOneBy')->willReturn($page);
$this->blockInteractor->method('loadPageBlocks')->willReturn([]);

$manager = $this->createManager($pageManager, $this->blockInteractor);

$page = 'test';
$site = new Site();

static::assertInstanceOf(PageInterface::class, $manager->getPage($site, $page));
static::assertInstanceOf(PageInterface::class, $manager->getPage($site, 'test'));
}

/**
Expand Down Expand Up @@ -179,15 +179,15 @@ public function testGetPageWithId(): void
{
$pageManager = $this->createMock(PageManagerInterface::class);

$pageManager->method('findOneBy')->willReturn(new Page());
$page = new Page();
$page->setId(42);
$pageManager->method('findOneBy')->willReturn($page);
$this->blockInteractor->method('loadPageBlocks')->willReturn([]);

$manager = $this->createManager($pageManager, $this->blockInteractor);

$page = 1;
$site = new Site();

static::assertInstanceOf(PageInterface::class, $manager->getPage($site, $page));
static::assertInstanceOf(PageInterface::class, $manager->getPage($site, 1));
}

/**
Expand Down Expand Up @@ -220,15 +220,16 @@ public function testGetPageWithoutParam(): void
{
$pageManager = $this->createMock(PageManagerInterface::class);

$pageManager->method('findOneBy')->willReturn(new Page());
$page = new Page();
$page->setId(42);
$pageManager->method('findOneBy')->willReturn($page);
$this->blockInteractor->method('loadPageBlocks')->willReturn([]);

$manager = $this->createManager($pageManager, $this->blockInteractor);
$manager->setCurrentPage(new Page());
$page = null;
$site = new Site();

static::assertInstanceOf(PageInterface::class, $manager->getPage($site, $page));
$site = new Site();
static::assertInstanceOf(PageInterface::class, $manager->getPage($site, null));
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/CmsManager/CmsSnapshotManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public function testGetPageWithId(): void
$pBlock->addChild($cBlock);
$pBlock->setId(1);

$page->method('getId')->willReturn(42);
$page->method('getBlocks')->willReturn([$pBlock]);

$this->snapshotManager
Expand Down

0 comments on commit c7b1889

Please sign in to comment.