General error: 1 no such table: sqlite_sequence

[Editied for clarity]

Lured by the elegance of cakephp-fixture-factories which was demo’d at the recent meetup, I did the install today.

…and ran afoul of

Exception: SQLSTATE[HY000]: 
General error:
1 no such table: sqlite_sequence
In [...cakephp/cakephp/src/Database/Driver/Sqlite.php, line 120]
Full output of test attempt
Testing started at 6:24 PM ...
--configuration /Library/WebServer/Documents/ampfg4/phpunit.xml.dist 
/Library/WebServer/Documents/ampfg4/tests --teamcity
PHPUnit 8.5.4 by Sebastian Bergmann and contributors.

Exception: SQLSTATE[HY000]: General error: 1 no such table: sqlite_sequence
In [/Library/WebServer/Documents/ampfg4/vendor/cakephp/cakephp/src/Database/Driver/Sqlite.php, line 120]

Process finished with exit code 1

The installation instructions state explicitly “the fixtures will be created in the test database(s) defined in your configuration.”

My test configuration performs as expected prior to plugin install.

I’ve traced the error to the addition of a Listener in phpunit.xml. This listener is a required part of the installation of the fixture plugin. I left the original Cake listeners in place too (as allowed by the installation instructions).

<listener class="CakephpFixtureFactories\TestSuite\FixtureInjector">
        <object class="CakephpFixtureFactories\TestSuite\FixtureManager" />
Full phpunit xml
<?xml version="1.0" encoding="UTF-8"?>
        <ini name="memory_limit" value="-1"/>
        <ini name="apc.enable_cli" value="1"/>

    <!-- Add any additional test suites you want to run here -->
        <testsuite name="app">
        <!-- Add plugin test suites here. -->

    <!-- Setup a listener for fixtures -->
        <listener class="CakephpFixtureFactories\TestSuite\FixtureInjector">
                <object class="CakephpFixtureFactories\TestSuite\FixtureManager" />
        <listener class="Cake\TestSuite\Fixture\FixtureInjector">
                <object class="Cake\TestSuite\Fixture\FixtureManager"/>

    <!-- Ignore vendor tests in code coverage reports -->
            <directory suffix=".php">src/</directory>
            <directory suffix=".php">plugins/*/src/</directory>

So it seems like there is something else I should be doing in the setup… But I’m out past the boundaries of my knowledge and into follow-directions-and-guess territory.

I did see some stuff around the web about tmp directory permissions and sqlite but fiddling with that has not got me working yet…


continuing our discussion, I found where the Sqlite error came from. Though you are working on a MySQL DB, I could like you, find no reason why an Sqlite error should show up.

In your test/bootstrap.php, you probably have that piece of code, which come from the CakePHP skeleton.

// But since PagesControllerTest is run with debug enabled and DebugKit is loaded
// in application, without setting up these config DebugKit errors out.
ConnectionManager::setConfig('test_debug_kit', [
    'className' => 'Cake\Database\Connection',
    'driver' => 'Cake\Database\Driver\Sqlite',
    'database' => TMP . 'debug_kit.sqlite',
    'encoding' => 'utf8',
    'cacheMetadata' => true,
    'quoteIdentifiers' => false,

ConnectionManager::alias('test_debug_kit', 'debug_kit');

I have amended the package in order to handle that case.