PHP名称空间常量未定义

I'm relatively new to PHP, and I'm trying to unit test some code within a namespace. unfortunately constant definition in a config file is giving me issues. Here is the relevant code.

directory structure is:

APITest
config.php
-/logging
-/test/logging

code of config.php:

<?php
namespace APITest;
define('BASE_DIR', pathinfo(__FILE__, PATHINFO_DIRNAME));

code of APITest/test/logging/TestLogItem:

namespace APITest\test\logging;
require_once( BASE_DIR . '/logging/LogItem.php');   
class TestLogItem extends PHPUnit_Framework_TestCase {

public function testLogItemCreationSuccess(){
    code
}

public function testLogItemCreationException(){
    code
}

public function testGetLogEntry(){
    code
}

error message is: PHP Notice: Use of undefined constant BASE_DIR - assumed 'BASE_DIR' in /var/test/APITest/test/logging/TestLogItem.php on line 6 PHP Warning: require_once(BASE_DIR/logging/LogItem.php): failed to open stream: No such file or directory in /var/test/APITest/test/logging/TestLogItem.php on line 6 PHP Fatal error: require_once(): Failed opening required 'BASE_DIR/logging/LogItem.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/test/APITest/test/logging/TestLogItem.php on line 6

You need to include config.php in the file.

It doesn't look like you are including the file anywhere, so as far as PHP is concerned the constant isn't defined.