function testGetDb() { $fake_db = __NAMESPACE__ . '\\FakeSSDB'; $db_plug = 'fake_ssdb'; \PMVC\option('set', 'GUID_DB', $db_plug); \PMVC\unplug($this->plug); PMVC\plug($db_plug, array(_CLASS => $fake_db)); $db = PMVC\plug($this->plug)->getDb('manager'); $this->assertEquals($fake_db, get_class($db->db)); }
<?php namespace PMVC\App\dimension; use PMVC; use PHPUnit_Framework_TestCase; PMVC\Load::plug(); PMVC\addPlugInFolders(['../']); /*Fake View*/ PMVC\initPlugIn(['controller' => null]); PMVC\l(__DIR__ . '/vendor/pmvc-plugin/controller/tests/resources/FakeView.php'); PMVC\plug('view', [_CLASS => '\\PMVC\\FakeView']); PMVC\option('set', 'DIMENSION_FOLDER', './tests/resources'); class DimensionActionTest extends PHPUnit_Framework_TestCase { function setup() { \PMVC\unplug('controller'); \PMVC\unplug(_RUN_APP); } function testProcessAction() { $pDot = \PMVC\plug('dotenv'); $pDot[\PMVC\PlugIn\dotenv\ENV_FOLDER] = __DIR__ . '/tests/resources'; $c = \PMVC\plug('controller'); $c->setApp('dimension'); $c->plugApp(['./']); $result = $c->process(); $actual = \PMVC\value($result, [0, 'v']); $expected = ['testKey' => 1234]; $this->assertEquals($expected, $actual);
public function __invoke() { PMVC\option('set', 'd', 1); }