Skip to content

Commit

Permalink
Add tests for Widget class
Browse files Browse the repository at this point in the history
  • Loading branch information
imanghafoori1 committed Jun 15, 2024
1 parent c7d0c0f commit 49ee07c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/WidgetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

namespace Tests;

use Illuminate\Contracts\Support\Renderable;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\View;
use Imanghafoori\Widgets\Widget;

class WidgetTest extends TestCase
{
Expand Down Expand Up @@ -106,6 +109,15 @@ public function test_json_widgets()
$this->assertEquals('123', $a);
}

public function test_widget_renderable_and_htmlable()
{
$widget = new Widget();
$this->assertInstanceOf(Htmlable::class, $widget);
$this->assertInstanceOf(Renderable::class, $widget);
$this->assertEquals('', $widget->toHtml());
$this->assertEquals('', $widget->render());
}

public function test_json_widgets_as_string()
{
Response::shouldReceive('json')->once()->with('222111', 200)->andReturn('123');
Expand Down

0 comments on commit 49ee07c

Please sign in to comment.