{ public function testA($foo) { return $foo; } public function testB($foo) { return $foo; } public function testWithError($foo) { throw new Exception('This is a test error'); } } // Use test bot class TwitterBotsFarm::$botClass = 'myTwitterBot'; $t->diag('Testing farm instanciation and configuration'); $farm = new TwitterBotsFarmMock(dirname(__FILE__) . '/yaml/sample_farm.yml'); $t->isa_ok($farm, 'TwitterBotsFarmMock', 'create() ok'); $t->isa_ok($farm->getConfig(), 'array', 'getConfig() ok'); $t->ok(array_key_exists('bots', $farm->getConfig()), 'getConfig() ok'); $t->diag('Testing configuration values retrieval'); $farm = new TwitterBotsFarmMock(dirname(__FILE__) . '/yaml/sample_farm.yml'); $t->isa_ok($farm->getBotConfig('myfirstbot'), 'array', 'getBotConfig() retrieves a bot configuration array'); $t->isa_ok($farm->getBotConfig('mysecondbot'), 'array', 'getBotConfig() retrieves a bot configuration array'); $t->is($farm->getGlobalConfigValue('password', 'fail'), 'foo', 'getGlobalConfigValue() retrieves expected global configured value'); $t->is($farm->getBotConfigValue('myfirstbot', 'password', 'fail'), 'bar', 'getBotConfigValue() retrieves expected configured value'); $t->is($farm->getBotConfigValue('mysecondbot', 'password', 'fail'), 'foo', 'getBotConfigValue() retrieves global configured value when not declared for a bot'); $t->diag('Testing debug mode activation'); ob_start(); // avoid sending output