Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c1cea7f
commit 0c49286
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
namespace Notion\Test\Common; | ||
|
||
use Notion\Common\Annotations; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class AnnotationsTest extends TestCase | ||
{ | ||
public function test_without_annotations(): void | ||
{ | ||
$annotations = Annotations::create(); | ||
|
||
$this->assertFalse($annotations->isBold()); | ||
$this->assertFalse($annotations->isItalic()); | ||
$this->assertFalse($annotations->isStrikeThrough()); | ||
$this->assertFalse($annotations->isUnderline()); | ||
$this->assertFalse($annotations->isCode()); | ||
$this->assertEquals("default", $annotations->color()); | ||
} | ||
|
||
public function test_bold(): void | ||
{ | ||
$annotations = Annotations::create()->bold(); | ||
|
||
$this->assertTrue($annotations->isBold()); | ||
} | ||
|
||
public function test_italic(): void | ||
{ | ||
$annotations = Annotations::create()->italic(); | ||
|
||
$this->assertTrue($annotations->isItalic()); | ||
} | ||
|
||
public function test_strike_through(): void | ||
{ | ||
$annotations = Annotations::create()->strikeThrough(); | ||
|
||
$this->assertTrue($annotations->isStrikeThrough()); | ||
} | ||
|
||
public function test_underline(): void | ||
{ | ||
$annotations = Annotations::create()->underline(); | ||
|
||
$this->assertTrue($annotations->isUnderline()); | ||
} | ||
|
||
public function test_code(): void | ||
{ | ||
$annotations = Annotations::create()->code(); | ||
|
||
$this->assertTrue($annotations->isCode()); | ||
} | ||
|
||
public function test_change_color(): void | ||
{ | ||
$annotations = Annotations::create()->withColor("red"); | ||
|
||
$this->assertEquals("red", $annotations->color()); | ||
} | ||
|
||
public function test_change_unsupported_color(): void | ||
{ | ||
$this->expectException(\Exception::class); | ||
Annotations::create()->withColor("not-a-color"); | ||
} | ||
} |