Skip to content

Commit 7e3138a

Browse files
authored
Merge pull request #23 from tattersoftware/navbar
Release
2 parents e1ac5c7 + b2fd567 commit 7e3138a

File tree

4 files changed

+92
-9
lines changed

4 files changed

+92
-9
lines changed

src/Views/Templates/form.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
<?= $this->extend(config('Layouts')->outbox) ?>
2-
<?= $this->section('main') ?>
1+
<?php $this->extend(config('Layouts')->outbox) ?>
2+
<?php $this->section('navbar') ?>
3+
4+
<?= view('Tatter\Outbox\Views\navbar') ?>
5+
6+
<?php $this->endSection() ?>
7+
<?php $this->section('main') ?>
38

49
<div class="row">
510
<div class="col">
@@ -39,4 +44,4 @@
3944
</div>
4045
</div>
4146

42-
<?= $this->endSection() ?>
47+
<?php $this->endSection() ?>

src/Views/Templates/index.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
<?= $this->extend(config('Layouts')->outbox) ?>
2-
<?= $this->section('main') ?>
1+
<?php $this->extend(config('Layouts')->outbox) ?>
2+
<?php $this->section('navbar') ?>
3+
4+
<?= view('Tatter\Outbox\Views\navbar') ?>
5+
6+
<?php $this->endSection() ?>
7+
<?php $this->section('main') ?>
38

49
<div class="row">
510
<div class="col">
@@ -47,4 +52,4 @@
4752
</div>
4853
</div>
4954

50-
<?= $this->endSection() ?>
55+
<?php $this->endSection() ?>

src/Views/Templates/send.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
<?= $this->extend(config('Layouts')->outbox) ?>
2-
<?= $this->section('main') ?>
1+
<?php $this->extend(config('Layouts')->outbox) ?>
2+
<?php $this->section('navbar') ?>
3+
4+
<?= view('Tatter\Outbox\Views\navbar') ?>
5+
6+
<?php $this->endSection() ?>
7+
<?php $this->section('main') ?>
38

49
<div class="row">
510
<div class="col">
@@ -71,4 +76,4 @@ class="form-control"
7176
</div>
7277
</div>
7378

74-
<?= $this->endSection() ?>
79+
<?php $this->endSection() ?>

tests/unit/ControllerTest.php

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php
2+
3+
use CodeIgniter\Exceptions\PageNotFoundException;
4+
use CodeIgniter\Test\ControllerTestTrait;
5+
use CodeIgniter\Test\DatabaseTestTrait;
6+
use Tatter\Outbox\Controllers\Templates;
7+
use Tatter\Outbox\Entities\Template;
8+
use Tatter\Outbox\Models\TemplateModel;
9+
use Tests\Support\OutboxTestCase;
10+
11+
/**
12+
* @internal
13+
*/
14+
final class ControllerTest extends OutboxTestCase
15+
{
16+
use ControllerTestTrait;
17+
use DatabaseTestTrait;
18+
19+
/**
20+
* Our Controller set by the trait
21+
*
22+
* @var Templates|null
23+
*/
24+
protected $controller;
25+
26+
/**
27+
* A test Template
28+
*
29+
* @var Template
30+
*/
31+
private $template;
32+
33+
protected function setUp(): void
34+
{
35+
parent::setUp();
36+
37+
$this->controller(Templates::class);
38+
39+
$this->template = new Template([
40+
'name' => 'Test Template',
41+
'subject' => 'Some {subject}',
42+
'body' => '<p>{number}</p>',
43+
]);
44+
$this->template->id = model(TemplateModel::class)->insert($this->template);
45+
}
46+
47+
public function testGetTemplate()
48+
{
49+
$result = $this->controller->getTemplate($this->template->id);
50+
51+
$this->assertSame($this->template->name, $result->name);
52+
}
53+
54+
public function testGetTemplateThrows()
55+
{
56+
$this->expectException(PageNotFoundException::class);
57+
58+
$this->controller->getTemplate(42);
59+
}
60+
61+
public function testIndexListsTemplates()
62+
{
63+
$result = $this->execute('index');
64+
65+
$result->assertStatus(200);
66+
$result->assertSee($this->template->name);
67+
}
68+
}

0 commit comments

Comments
 (0)