From a625a3a7ffacde6eeb0138249d5c0189ab66475d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Turek?= Date: Tue, 10 Oct 2023 11:19:10 +0200 Subject: [PATCH 1/2] Support for non-table model types (2.x) --- src/Command/TestCommand.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Command/TestCommand.php b/src/Command/TestCommand.php index 9fe9cd91..7dc6ebd8 100644 --- a/src/Command/TestCommand.php +++ b/src/Command/TestCommand.php @@ -24,6 +24,7 @@ use Cake\Core\Configure; use Cake\Core\Exception\CakeException; use Cake\Core\Plugin; +use Cake\Datasource\RepositoryInterface; use Cake\Filesystem\Filesystem; use Cake\Http\Response; use Cake\Http\ServerRequest as Request; @@ -459,12 +460,15 @@ public function generateFixtureList($subject): array /** * Process a model, pull out model name + associations converted to fixture names. * - * @param \Cake\ORM\Table $subject A Model class to scan for associations and pull fixtures off of. + * @param @param \Cake\Datasource\RepositoryInterface $subject A Model class to scan for associations and pull fixtures off of. * @return void */ - protected function _processModel(Table $subject): void + protected function _processModel(RepositoryInterface $subject): void { $this->_addFixture($subject->getAlias()); + if (!method_exists($subject, 'associations')) { + return; + } foreach ($subject->associations()->keys() as $alias) { $assoc = $subject->getAssociation($alias); $target = $assoc->getTarget(); From 62a695640e05ca138c181a3c662fc46bdbd8aed3 Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Tue, 12 Dec 2023 06:03:36 +0100 Subject: [PATCH 2/2] Update TestCommand.php --- src/Command/TestCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/TestCommand.php b/src/Command/TestCommand.php index 7dc6ebd8..24923f36 100644 --- a/src/Command/TestCommand.php +++ b/src/Command/TestCommand.php @@ -460,7 +460,7 @@ public function generateFixtureList($subject): array /** * Process a model, pull out model name + associations converted to fixture names. * - * @param @param \Cake\Datasource\RepositoryInterface $subject A Model class to scan for associations and pull fixtures off of. + * @param \Cake\Datasource\RepositoryInterface $subject A Model class to scan for associations and pull fixtures off of. * @return void */ protected function _processModel(RepositoryInterface $subject): void