Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 27, 2021

Conversation

Raruto
Copy link
Contributor

@Raruto Raruto commented Jan 25, 2021

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
Copy link
Member

aheinze commented Jan 27, 2021

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