php - Laravel Schema::create ignoring table prefix when run from Unit Test -


I have an unit test that is running cede I create a new instance to build One of my classes is when I run cedar from artisan, then it runs without problems. However, when the unit test does this:

  class increases MyClassTest TestCase {Public Function Setup () {// Setup Application Parent: Setup ( ); $ This- & gt; Seed ('MyClassSeeder'); }   

... refused to use the prefix

  Class MyClass has switched to base {// correct DB prefix protected function prefix () (db :: connection ('main') -> set-up parameter ($ this-> id '_'); $ this return;} // It is run by cedar, everything works fine here ... public function setup database () {$ this-> prefix (); // gives it "1001_", which is the correct log: : Info (schema :: connection ('main') - & g T; mill connection () -> getTablePrefix ()); // schema :: connection ('main') -> gt; hatable ('myTable')) {schema :: connection ('main') -> gt; ; Instead of 'myTable', instead of "1001_myTable" creates "myTable", function ($ table) {...   

when it works fine when running manually That is, I do not even know where to start. This is also refunding the appropriate prefix, not just using it. Has anyone seen this? Is it reproducible? Does the test environment (which is automatically used by unit tests) change anything other than the filter, which I have already re-enabled?

Any help would be appreciated. Even a reproduction will at least tell me that this is not our code. We've expanded a bit, but there should not be any major changes in our founder Laravel codebase.

Better Test

So I continued my trial and found out what a bug looks like, though I will look forward to it, I am posting it here Someone's memory for any such problem:

I modified

  login: info (schema :: Connection ('main') - & gt; getConnection () -> getTablePrefix ());   

be

  log :: info ('grammar prefix:'. Schema :: connection ('promotion ') -> GetConnection () -> getSchemaGrammar () -> GetTablePrefix ()); Log :: Info ('Connection prefix:' Schema :: Connection ('Promotions') - & gt; Mill Connection () - & gt; getTablePrefix ());   

It was found that when the prefix line of connection works well, then the prefix of grammar is non-existent. Grammar and Connection do not match prefix. I can work around it, but I would like to know why it is kept continuously when it is run in any other way other than Unit Testing Class, but there is a mismatch here. Reporting as a bug is coming soon if it appears to someone else

last test

What I can tell, The code should get the initial setting from the database config file, and then both the blueprints and the schema when the line

  DB :: connection ('promotion') - & gt; SetTablePrefix ($ this-> id '_');   

is run I have also worked on running around it

  db :: connection (' Promotion ') - & gt; GetSchemaGrammar () - & gt; SetTablePrefix ($ this-> ID. '_');   

It should not be necessary to fix the problem, and I do not see any reason that the code I am using should not have the desired effect . I am thinking of this one bug, and later will report today. If I am missing something then I open up a little question, but I will close it soon.

I've come to the conclusion that this is a bug, there is no explanation why it works in an environment Do it, but not the second until the test is doing something different from a default environment, and I can not find it.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -