Skip to content

Commit

Permalink
Add test for publish state
Browse files Browse the repository at this point in the history
  • Loading branch information
aerni committed Aug 30, 2024
1 parent 50a1bb3 commit 5fd4b11
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,24 @@ public function test_term_can_be_created_in_site()
$term = FactoryTestTermFactory::new()->site('nonexsiting_site')->create();
$this->assertNotContains($term->localizations()->keys()->all(), ['nonexsiting_site']);
}

public function test_can_set_publish_state()
{
$entry = FactoryTestEntryFactory::new()->published(true)->create();
$this->assertSame(true, $entry->published());

$entry = FactoryTestEntryFactory::new()->published(false)->create();
$this->assertSame(false, $entry->published());

$entry = FactoryTestEntryFactory::new()->published('false')->create();
$this->assertSame(false, $entry->published());

$entry = FactoryTestEntryFactory::new()->site('random')->create();
$this->assertContains($entry->published(), [true, false]);

$entry = FactoryTestEntryFactory::new()->site('anything')->create();
$this->assertSame(true, $entry->published());
}
}

class FactoryTestEntryFactory extends Factory
Expand Down

0 comments on commit 5fd4b11

Please sign in to comment.