/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { require_once 'vendor/autoload.php'; include 'config/config.php'; $app = \MfBase\MfWrapper::create($config); $this->object = new \MfPackage\MfBaseManager(); ORM::for_table('members')->delete_many(); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { require_once 'vendor/autoload.php'; include 'config/config.php'; $config = []; $app = \MfBase\MfWrapper::create($config); $this->app = $app; $this->object = new TestValidation($app); // カスタムバリデーションルール $this->object->setExtendValidation('hogehoge', function ($attribute, $value = null, $parameters = null) { return 1 === $value; }, ':attributeは不正です'); }
/** * Slimインスタンスの生成およびModerateFwのセットアップ * * @param type $config * @param type $loader * @return \Base\SlimWrapper */ public static function create($config = null, $loader = null) { // Slim frameworkのインスタンスを生成 $app = new MfWrapper($config, $loader); // ModerateFwのApp側のファイルのrequire_once(autoload)をセット $app->setAutoload(); // Middlewareのセット $app->add(new MfManager($app->loader, $app->namespaces['manager'])); $app->add(new MfController($app->loader, $app->namespaces['controller'])); // セッション設定 $app->setSession($config); // DB設定を実施 $app->setDatabase(); return $app; }