Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing Lithium's core independently of an app #326

Closed
mehlah opened this issue Feb 10, 2012 · 2 comments
Closed

Testing Lithium's core independently of an app #326

mehlah opened this issue Feb 10, 2012 · 2 comments
Labels
Milestone

Comments

@mehlah
Copy link
Contributor

mehlah commented Feb 10, 2012

Lithium tests heavily needs a resources/ directory which comes with a default app layout.
Testing Lithium's independently of that is hard, or not so cool because of a lot of skippings if resources isn't available.

I'm fixing exceptions raised when building with Travis, and a lot are essentially related to this same problem.

What could be done ?

  • having a "global" setUp() where we check if Libraries::get(true, 'resources') is available, and if not, creates a tmp folder near lithium's core, or use getenv('TMPDIR') as suggested @cgarvis on IRC
  • using Travis before_script and after_script in build configuration, where we manually creates a resources directory where tests are ran.
  • never test Lithium without a default app directories layout (Evil)
@nateabele
Copy link
Member

I have an idea. As you can see here, if Lithium is bootstrapped from the console outside of an application, it just pretends that the default application lives in the current directory anyway.

I think if we just use this along with @cgarvis' idea, we can just add a line to that configuration like 'resources' => getenv('TMPDIR'), and everything should just work. However, while we're on the topic, there are also tests in Media (and possibly elsewhere) that depend on a webroot directory. I'm still trying to think through how to handle these, and/or if they have to just be rewritten completely. For now I would suggest just skipping them.

@nateabele
Copy link
Member

We have this in lithium.php now, which should cover this issue:

    lithium\core\Libraries::add(basename($working), array(
        'default' => true,
        'path' => $working,
        'resources' => sys_get_temp_dir()
    ));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants