Skip to content

Commit

Permalink
Update fixtures, fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jun 1, 2024
1 parent f20e02a commit 70e0b34
Show file tree
Hide file tree
Showing 5 changed files with 175 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/View/Helper/BakeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
use Cake\Core\Configure;
use Cake\Core\ConventionsTrait;
use Cake\Database\Schema\TableSchema;
use Cake\Database\Type\EnumType;
use Cake\Database\TypeFactory;
use Cake\Datasource\SchemaInterface;
use Cake\Database\Type\EnumType;
use Cake\ORM\Table;
use Cake\Utility\Inflector;
use Cake\View\Helper;
Expand Down
48 changes: 48 additions & 0 deletions tests/comparisons/Template/testBakeIndexWithEnumNoLabel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* @var \Bake\Test\App\View\AppView $this
* @var iterable<\Cake\Datasource\EntityInterface> $articles
*/
?>
<div class="articles index content">
<?= $this->Html->link(__('New Article'), ['action' => 'add'], ['class' => 'button float-right']) ?>
<h3><?= __('Articles') ?></h3>
<div class="table-responsive">
<table>
<thead>
<tr>
<th><?= $this->Paginator->sort('id') ?></th>
<th><?= $this->Paginator->sort('author_id') ?></th>
<th><?= $this->Paginator->sort('title') ?></th>
<th><?= $this->Paginator->sort('published') ?></th>
<th class="actions"><?= __('Actions') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($articles as $article): ?>
<tr>
<td><?= $this->Number->format($article->id) ?></td>
<td><?= $article->hasValue('author') ? $this->Html->link($article->author->name, ['controller' => 'Authors', 'action' => 'view', $article->author->id]) : '' ?></td>
<td><?= h($article->title) ?></td>
<td><?= $article->published === null ? '' : h($article->published->value) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['action' => 'view', $article->id]) ?>
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $article->id]) ?>
<?= $this->Form->postLink(__('Delete'), ['action' => 'delete', $article->id], ['confirm' => __('Are you sure you want to delete # {0}?', $article->id)]) ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="paginator">
<ul class="pagination">
<?= $this->Paginator->first('<< ' . __('first')) ?>
<?= $this->Paginator->prev('< ' . __('previous')) ?>
<?= $this->Paginator->numbers() ?>
<?= $this->Paginator->next(__('next') . ' >') ?>
<?= $this->Paginator->last(__('last') . ' >>') ?>
</ul>
<p><?= $this->Paginator->counter(__('Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')) ?></p>
</div>
</div>
50 changes: 50 additions & 0 deletions tests/comparisons/Template/testBakeIndexWithEnumWithLabel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* @var \Bake\Test\App\View\AppView $this
* @var iterable<\Cake\Datasource\EntityInterface> $bakeUsers
*/
?>
<div class="bakeUsers index content">
<?= $this->Html->link(__('New Bake User'), ['action' => 'add'], ['class' => 'button float-right']) ?>
<h3><?= __('Bake Users') ?></h3>
<div class="table-responsive">
<table>
<thead>
<tr>
<th><?= $this->Paginator->sort('id') ?></th>
<th><?= $this->Paginator->sort('username') ?></th>
<th><?= $this->Paginator->sort('status') ?></th>
<th><?= $this->Paginator->sort('created') ?></th>
<th><?= $this->Paginator->sort('updated') ?></th>
<th class="actions"><?= __('Actions') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($bakeUsers as $bakeUser): ?>
<tr>
<td><?= $this->Number->format($bakeUser->id) ?></td>
<td><?= h($bakeUser->username) ?></td>
<td><?= $bakeUser->status === null ? '' : h($bakeUser->status->label()) ?></td>
<td><?= h($bakeUser->created) ?></td>
<td><?= h($bakeUser->updated) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['action' => 'view', $bakeUser->id]) ?>
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $bakeUser->id]) ?>
<?= $this->Form->postLink(__('Delete'), ['action' => 'delete', $bakeUser->id], ['confirm' => __('Are you sure you want to delete # {0}?', $bakeUser->id)]) ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="paginator">
<ul class="pagination">
<?= $this->Paginator->first('<< ' . __('first')) ?>
<?= $this->Paginator->prev('< ' . __('previous')) ?>
<?= $this->Paginator->numbers() ?>
<?= $this->Paginator->next(__('next') . ' >') ?>
<?= $this->Paginator->last(__('last') . ' >>') ?>
</ul>
<p><?= $this->Paginator->counter(__('Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')) ?></p>
</div>
</div>
2 changes: 1 addition & 1 deletion tests/comparisons/Template/testBakeViewEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</tr>
<tr>
<th><?= __('Status') ?></th>
<td><?= $bakeUser->status === null ? '' : $this->Number->format($bakeUser->status) ?></td>
<td><?= $bakeUser->status === null ? '' : h($bakeUser->status->label()) ?></td>
</tr>
<tr>
<th><?= __('Created') ?></th>
Expand Down
75 changes: 75 additions & 0 deletions tests/comparisons/Template/testBakeViewEnumNoLabel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php
/**
* @var \Bake\Test\App\View\AppView $this
* @var \Cake\Datasource\EntityInterface $article
*/
?>
<div class="row">
<aside class="column">
<div class="side-nav">
<h4 class="heading"><?= __('Actions') ?></h4>
<?= $this->Html->link(__('Edit Article'), ['action' => 'edit', $article->id], ['class' => 'side-nav-item']) ?>
<?= $this->Form->postLink(__('Delete Article'), ['action' => 'delete', $article->id], ['confirm' => __('Are you sure you want to delete # {0}?', $article->id), 'class' => 'side-nav-item']) ?>
<?= $this->Html->link(__('List Articles'), ['action' => 'index'], ['class' => 'side-nav-item']) ?>
<?= $this->Html->link(__('New Article'), ['action' => 'add'], ['class' => 'side-nav-item']) ?>
</div>
</aside>
<div class="column column-80">
<div class="articles view content">
<h3><?= h($article->title) ?></h3>
<table>
<tr>
<th><?= __('Author') ?></th>
<td><?= $article->hasValue('author') ? $this->Html->link($article->author->name, ['controller' => 'Authors', 'action' => 'view', $article->author->id]) : '' ?></td>
</tr>
<tr>
<th><?= __('Title') ?></th>
<td><?= h($article->title) ?></td>
</tr>
<tr>
<th><?= __('Id') ?></th>
<td><?= $this->Number->format($article->id) ?></td>
</tr>
<tr>
<th><?= __('Published') ?></th>
<td><?= $article->published === null ? '' : h($article->published->value) ?></td>
</tr>
</table>
<div class="text">
<strong><?= __('Body') ?></strong>
<blockquote>
<?= $this->Text->autoParagraph(h($article->body)); ?>
</blockquote>
</div>
<div class="related">
<h4><?= __('Related Tags') ?></h4>
<?php if (!empty($article->tags)) : ?>
<div class="table-responsive">
<table>
<tr>
<th><?= __('Id') ?></th>
<th><?= __('Name') ?></th>
<th><?= __('Description') ?></th>
<th><?= __('Created') ?></th>
<th class="actions"><?= __('Actions') ?></th>
</tr>
<?php foreach ($article->tags as $tag) : ?>
<tr>
<td><?= h($tag->id) ?></td>
<td><?= h($tag->name) ?></td>
<td><?= h($tag->description) ?></td>
<td><?= h($tag->created) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['controller' => 'tags', 'action' => 'view', $tag->id]) ?>
<?= $this->Html->link(__('Edit'), ['controller' => 'tags', 'action' => 'edit', $tag->id]) ?>
<?= $this->Form->postLink(__('Delete'), ['controller' => 'tags', 'action' => 'delete', $tag->id], ['confirm' => __('Are you sure you want to delete # {0}?', $tag->id)]) ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>

0 comments on commit 70e0b34

Please sign in to comment.