mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-04 15:26:43 +02:00
build(app): bootstrap codeigniter4 app using docker-compose
This commit is contained in:
parent
11080d46d1
commit
9070ca2651
87 changed files with 5411 additions and 8 deletions
42
src/tests/database/ExampleDatabaseTest.php
Normal file
42
src/tests/database/ExampleDatabaseTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
use Tests\Support\Models\ExampleModel;
|
||||
|
||||
class ExampleDatabaseTest extends \Tests\Support\DatabaseTestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
// Extra code to run before each test
|
||||
}
|
||||
|
||||
public function testModelFindAll()
|
||||
{
|
||||
$model = new ExampleModel();
|
||||
|
||||
// Get every row created by ExampleSeeder
|
||||
$objects = $model->findAll();
|
||||
|
||||
// Make sure the count is as expected
|
||||
$this->assertCount(3, $objects);
|
||||
}
|
||||
|
||||
public function testSoftDeleteLeavesRow()
|
||||
{
|
||||
$model = new ExampleModel();
|
||||
$this->setPrivateProperty($model, 'useSoftDeletes', true);
|
||||
$this->setPrivateProperty($model, 'tempUseSoftDeletes', true);
|
||||
|
||||
$object = $model->first();
|
||||
$model->delete($object->id);
|
||||
|
||||
// The model should no longer find it
|
||||
$this->assertNull($model->find($object->id));
|
||||
|
||||
// ... but it should still be in the database
|
||||
$result = $model->builder()->where('id', $object->id)->get()->getResult();
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue