mysql测试驱动程序,使用phpunit测试zend会给我“当前未安装mysql驱动程序”。

i have this testing class

class IndexControllerTest extends ControllerTestCase

{

....

public function testValidLoginShouldGoToProfilePage()

{

$this->request->setMethod('POST')

->setPost(array(

'email' => 'capoarea',

'password' => '123456'

));

$this->dispatch('/user/login');

$this->assertRedirectTo('/index/index');

$this->resetRequest()

->resetResponse();

$this->request->setMethod('GET')

->setPost(array());

$this->dispatch('/cliente/index');

$this->assertRoute('default');

$this->assertModule('default');

$this->assertController('cliente');

$this->assertAction('index');

$this->assertNotRedirect();

}

}

and this application.ini

[production]

.....

resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"

resources.db.params.charset = "utf8"

resources.db.adapter = "pdo_mysql"

resources.db.params.host = "localhost"

resources.db.params.username = "root"

resources.db.params.password = ""

resources.db.params.dbname = "gestionale"

resources.db.isDefaultTableAdapter = true

autoloaderNamespaces[] = "Gestionale_";serve per caricare il plugin di sotto quando si usa anche ZFdebug

resources.frontController.plugins.acl = "Gestionale_Controller_Plugin_Acl"

resources.db.params.profiler = true

....

[testing : production]

phpSettings.display_startup_errors = 1

phpSettings.display_errors = 1

and i get this error

9RFJB.png

in application ini testing extends production so it should have all db config, what am i doing wrong ?

解决方案

Most likely your php command line interpreter uses a different php.ini file.

To check for MySQL driver open a new shell prompt and run php -m and check that mysql extensions are loaded.

> php -m | grep -i sql

mysql

mysqli

mysqlnd

pdo_mysql

pdo_sqlite

SQLite

sqlite3

To see what ini file is loaded use the -i flag of php command

> php -i | grep ini

Configuration File (php.ini) Path => /opt/local/etc/php5

Loaded Configuration File => /opt/local/etc/php5/php.ini

Scan this dir for additional .ini files => /opt/local/var/db/php5

Additional .ini files parsed => /opt/local/var/db/php5/apc.ini,

Don't know if on windows there is a grep like command to filter the output, if not you have to examine all the output of both php -m and php -i to gather the required lines or install a windows grep utility

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值