Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jflearn committed Sep 25, 2024
1 parent 577f517 commit 482c565
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions tests/unit/Model/RollupPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,45 +46,45 @@ public function testChildren() {
$rollupPage = RollupPage::create();
$rollupPage->ShowLinksOnly = 1;
$rollupPage->write();
$rollupPage->publish( 'Stage', 'Live' );
$rollupPage->publishSingle();

$this->assertEquals( 0, $rollupPage->Children()->count() );

$page1 = Page::create();
$page1->Content = '<p>Page 1</p>';
$page1->ParentID = $rollupPage->ID;
$page1->write();
$page1->publish( 'Stage', 'Live' );
$page1->publishSingle();

$page2 = Page::create();
$page2->Content = '';
$page2->ParentID = $rollupPage->ID;
$page2->write();
$page2->publish( 'Stage', 'Live' );
$page2->publishSingle();

$rollupPage->write();
$rollupPage->publish( 'Stage', 'Live' );
$rollupPage->publishSingle();

$this->assertEquals( 1, $rollupPage->Children()->count() );

$page2->Content = '<p>Page 2</p>';
$page2->write();
$page2->publish( 'Stage', 'Live' );
$page2->publishSingle();

$rollupPage->write();
$rollupPage->publish( 'Stage', 'Live' );
$rollupPage->publishSingle();

$this->assertEquals( 2, $rollupPage->Children()->count() );

$rollupPage->ShowLinksOnly = 2;
$rollupPage->write();
$rollupPage->publish( 'Stage', 'Live' );
$rollupPage->publishSingle();

$this->assertEquals( 0, $rollupPage->Children()->count() );

$rollupPage->ShowLinksOnly = 0;
$rollupPage->write();
$rollupPage->publish( 'Stage', 'Live' );
$rollupPage->publishSingle();

$this->assertEquals( 0, $rollupPage->Children()->count() );
}
Expand Down Expand Up @@ -120,22 +120,22 @@ public function testContent() {
$rollupPage->Title = 'Rollup Page';
$rollupPage->ShowLinksOnly = 0;
$rollupPage->write();
$rollupPage->publish( 'Stage', 'Live' );
$rollupPage->publishSingle();


$page1 = Page::create();
$page1->Title = 'Page 1';
$page1->Content = '<p>Page 1 content</p>';
$page1->ParentID = $rollupPage->ID;
$page1->write();
$page1->publish( 'Stage', 'Live' );
$page1->publishSingle();

$page2 = FakePage::create();
$page2->Title = 'Page 2';
$page2->Content = '<p>Page 2 content</p>';
$page2->ParentID = $rollupPage->ID;
$page2->write();
$page2->publish( 'Stage', 'Live' );
$page2->publishSingle();

$this->assertStringContainsString( '<p>Page 1 content</p>', $rollupPage->Content() );
$this->assertStringContainsString( '<p>Page 2 content</p>', $rollupPage->Content() );
Expand All @@ -145,13 +145,13 @@ public function testContent() {

$rollupPage->ShowLinksOnly = 1;
$rollupPage->write();
$rollupPage->publish( 'Stage', 'Live' );
$rollupPage->publishSingle();

$page1->write();
$page1->publish( 'Stage', 'Live' );
$page1->publishSingle();

$page2->write();
$page2->publish( 'Stage', 'Live' );
$page2->publishSingle();

$this->assertStringNotContainsString( '<p>Page 1 content</p>', $rollupPage->Content() );
$this->assertStringContainsString( '<nav class="rollup-page-navigation-list">', $rollupPage->Content() );
Expand All @@ -162,17 +162,17 @@ public function testContent() {

$rollupPage->ShowLinksOnly = 2;
$rollupPage->write();
$rollupPage->publish( 'Stage', 'Live' );
$rollupPage->publishSingle();

$page1->write();
$page1->publish( 'Stage', 'Live' );
$page1->publishSingle();

$page2->Content = '';
$page2->write();
$page2->publish( 'Stage', 'Live' );
$page2->publishSingle();

$rollupPage->write();
$rollupPage->publish( 'Stage', 'Live' );
$rollupPage->publishSingle();

$this->assertStringContainsString( '<p>Page 1 content</p>', $rollupPage->Content() );
$this->assertStringContainsString( '<nav class="rollup-page-navigation-tabs">', $rollupPage->Content() );
Expand Down

0 comments on commit 482c565

Please sign in to comment.