Skip to content

Fix "Forms::entries" throws undefined "getform" method in "MongoHybrid\MongoLite" - #1407

Merged
aheinze merged 1 commit into
agentejo:nextfrom
Raruto:entries-fix
Jan 27, 2021
Merged

Fix "Forms::entries" throws undefined "getform" method in "MongoHybrid\MongoLite"#1407
aheinze merged 1 commit into
agentejo:nextfrom
Raruto:entries-fix

Conversation

@Raruto

@Raruto Raruto commented Jan 25, 2021

Copy link
Copy Markdown
Contributor

Related to: #1406


phpunit log:

1) CockpitTests\Test\FormsTest::testEntries
call_user_func_array() expects parameter 1 to be a valid callback, class 'MongoHybrid\MongoLite' does not have a method 'getform'

D:\htdocs\cockpit\lib\MongoHybrid\Client.php:425
D:\htdocs\cockpit\modules\Forms\bootstrap.php:155
D:\htdocs\cockpit\lib\Lime\App.php:1260
D:\htdocs\cockpit\bootstrap.php:292
D:\htdocs\cockpit\tests\modules\FormsTest.php:99

ERRORS!
Tests: 13, Assertions: 12, Errors: 1.

CockpitTests\Test\FormsTest::testEntries

/**
 * @covers \Forms::entries
 */
public function testEntries() {
  $entries = cockpit('forms:entries', static::$mockFormId);
  $this->assertTrue($entries instanceof \MongoLite\Collection);
}

Forms::entries

// modules/forms/bootstrap.php#L147

'entries' => function($name) {

  $forms = $this->form($name);

  if (!$forms) return false;

  $form = $forms['_id'];

  return $this->app->storage->getform("forms/{$form}"); // <-- getform is undefined in "MongoHybrid\MongoLite"
},

Have a nice Day,
Raruto

@aheinze
aheinze merged commit 28d724e into agentejo:next Jan 27, 2021
@aheinze

aheinze commented Jan 27, 2021

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants