1 year ago

PHPUnit MySQL in memory test with point and polygon column

Posted 1 year ago by PoncetheLion

I have a migration for a table as following:

    use Illuminate\Support\Facades\Schema;
    use Grimzy\LaravelMysqlSpatial\Schema\Blueprint;  //use this as blueprint
    use Illuminate\Database\Migrations\Migration;
Schema::create('properties', function (Blueprint $table) {

Also, I am using this library and added trait to the property model:


Before updating the position and area_perimeter to use geospatial type, the PHPUnit works with

<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="MAIL_DRIVER" value="array"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
<env name="TELESCOPE_ENABLED" value="false"/>

But now it no longer works and I am getting this error:

Argument 1 passed to CreatePropertiesTable::{closure}() must be an instance of Grimzy\LaravelMysqlSpatial\Schema\Blueprint, instance of Illuminate\Database\Schema\Blueprint given

Which has something to do with sqlite does not support point and polygon column

I would like to be able to run phpunit on mysql in memory. Or how can I make this work with the said requirements?

Please sign in or create an account to participate in this conversation.