laravel-url-shortener
laravel-url-shortener copied to clipboard
Bitbucket Pipeline error
Unfortunately after adding the package "magarrent/laravel-url-shortener" I've encountered the following problem with Bitbucket Pipeline build:
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php https://bitbucket.org/censored/src/6d017547e680cb4ff20585b5647ceda95eb7dc16/artisan package:discover --ansi
Illuminate\Database\QueryException
SQLSTATE[HY000] [1045] Access denied for user 'forge'@'127.0.0.1' (using password: NO) (SQL: select * from information_schema.tables where table_schema = forge and table_name = url_shorteners and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712
708▕ // If an exception occurs when attempting to run a query, we'll format the error
709▕ // message to include the bindings with SQL, which will make this exception a
710▕ // lot more helpful to the developer instead of just the database's errors.
711▕ catch (Exception $e) {
➜ 712▕ throw new QueryException(
713▕ $query, $this->prepareBindings($bindings), $e
714▕ );
715▕ }
716▕ }
1 [internal]:0
Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Magarrent\LaravelUrlShortener\LaravelUrlShortenerServiceProvider))
[2m+23 vendor frames [22m
25 [internal]:0
Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Magarrent\LaravelUrlShortener\LaravelUrlShortenerServiceProvider))
Script @php https://bitbucket.org/censored/src/6d017547e680cb4ff20585b5647ceda95eb7dc16/artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
Any suggestions how to stop it hitting database during artisan package:discover call?
Hey @HappySoft , the package needs to store data to the BD, so you need a connection
@magarrent ,
The package hits DB before I have chance to run php artisan test. At this moment DB is blank and schema is created before tests run. Looking into the package source code, I am afraid unit testing was not considered at all :(
@magarrent , The package hits DB before I have chance to run
php artisan test. At this moment DB is blank and schema is created before tests run. Looking into the package source code, I am afraid unit testing was not considered at all :(
Did you run the migrations in your tests?
@magarrent ,
php artisan test loads DB schema for testing database, no need to run any migrations manually.
@HappySoft yes, but you attached a DB connection error:
SQLSTATE[HY000] [1045] Access denied for user 'forge'@'127.0.0.1'
Did you configure the Mysql Connection in the Test environment?
@magarrent , basically what pipeline build does is:
composer install # the error happens here
cp .env.example .env
php artisan test --without-tty
I tried to set up .env file before running composer install - no luck too, because DB is empty yet.