Skip to content

Call to undefined function #23

Closed
Closed
@stefthoen

Description

@stefthoen

For the last couple of days I've been trying to get tests to work in themes. I test with a new theme with just a index.php, a style.css and a functions.php file. I have this function in functions.php:

function test_theme() {
    return 'hi';
}

And my test:

function test_sample() {
    // Replace this with some actual testing code.
    $this->assertTrue( true );
    $this->assertEquals( 'hi', test_theme() );
}

When I run the test, PHPUnit gives an error:

There was 1 error:

1) SampleTest::test_sample
Error: Call to undefined function test_theme()

Is there something simple I'm overlooking? For any debug info about my setup/system, please see #22.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions