Skip to content

Commit b618dcf

Browse files
committed
test: add test for preserving sub-namespace in entity generation
1 parent 5c74ff7 commit b618dcf

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

tests/system/Commands/Generators/ModelGeneratorTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,33 @@ public function testGenerateModelWithOptionSuffix(): void
134134
rmdir(dirname($entity));
135135
}
136136

137+
public function testGenerateModelWithSubNamespaceAndReturnEntity(): void
138+
{
139+
command('make:model admin/class --return entity');
140+
141+
$model = APPPATH . 'Models/Admin/Class.php';
142+
$entity = APPPATH . 'Entities/Admin/Class.php';
143+
144+
$this->assertFileExists($model);
145+
$this->assertFileExists($entity);
146+
147+
if (is_file($model)) {
148+
unlink($model);
149+
}
150+
$modelDir = dirname($model);
151+
if (is_dir($modelDir)) {
152+
rmdir($modelDir);
153+
}
154+
155+
if (is_file($entity)) {
156+
unlink($entity);
157+
}
158+
$entityDir = dirname($entity);
159+
if (is_dir($entityDir)) {
160+
rmdir($entityDir);
161+
}
162+
}
163+
137164
/**
138165
* @see https://github.com/codeigniter4/CodeIgniter4/issues/5050
139166
*/

0 commit comments

Comments
 (0)