Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 886257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:02:17+00:00 2026-05-15T13:02:17+00:00

I am currently doing unit testing, and use folders to organize my test cases.

  • 0

I am currently doing unit testing, and use folders to organize my test cases. All cases pertaining to managing of user accounts, for example, go under \tests\accounts. Over time, there are more test cases, and I begin to seperate the cases by types, such as \tests\accounts\create, \tests\account\update and etc.

However, one annoying problem is I have to specify the path to a set of common includes. I have to use includes like this:

include_once ("../../../../autoload.php");
include_once ("../../../../init.php");

A test case in tests\accounts\ would require change to the include (one less directory level down). Is there anyway to have them somehow locating my two common includes? I understand I could set include paths within my PHP’s configurations, or use server environment variables, but I would like to avoid such solutions as they make the application less portable and coupled with another layer which the programmer can’t control (some web-host doesn’t allow configuration of PHP’s configuration settings, for example)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T13:02:18+00:00Added an answer on May 15, 2026 at 1:02 pm

    you could try using “include_path” in php.ini or use the function set_include_path in php
    http://php.net/manual/en/function.set-include-path.php

    set_include_path('/home/www/...');
    

    or

    set_include_path('../../../');
    

    also, you make a constant in a global file, then

    define('DIR_PATH', '../../');
    include_once(DIR_PATH . 'file');
    

    because the “set_include_path” isnt so efficient.

    Hope I helped

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I'm doing some unit tests which are executed from bash. Unit tests are
I'm currently doing some GUI testing on a ASP.net 2.0 application. The RDBMS is
I'm currently doing the following to use typed datasets in vs2008: Right click on
I am currently doing some socket programming using C/C++. To be able to use
I'm currently looking into unit testing for a new application I have to create.
Currently doing a test plan for a system. May I know what are the
In my current Rails 3 app, I'm doing some unit testing to make sure
We're currently using MBUnit for both unit testing and UI testing. For UI testing
i'm currently doing some reports for SSRS, and i just confirm what i already
I am currently doing IE-hacks on a website I'm working on: http://www.timkjaerlange.com/wip/co2penhagen/ I got

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.