Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new Model does not import Str class #99

Closed
mattKendon opened this issue Mar 20, 2016 · 1 comment
Closed

new Model does not import Str class #99

mattKendon opened this issue Mar 20, 2016 · 1 comment

Comments

@mattKendon
Copy link
Contributor

Just run into a major bug with the base Model class. The belongsTo method references the Illuminate\Support\Str class but does not import it.

Testing started at 21:24 ...
PHPUnit 4.2.2 by Sebastian Bergmann.

Configuration read from C:\xampp\htdocs\corcel\phpunit.xml

PHP Fatal error:  Uncaught Error: Class 'Corcel\Str' not found in C:\xampp\htdocs\corcel\src\Model.php:39
Stack trace:
#0 C:\xampp\htdocs\corcel\src\PostMeta.php(32): Corcel\Model->belongsTo('Corcel\\Post')
#1 C:\xampp\htdocs\corcel\vendor\illuminate\database\Eloquent\Model.php(2689): Corcel\PostMeta->post()
#2 C:\xampp\htdocs\corcel\vendor\illuminate\database\Eloquent\Model.php(2662): Illuminate\Database\Eloquent\Model->getRelationshipFromMethod('post')
#3 C:\xampp\htdocs\corcel\src\Model.php(76): Illuminate\Database\Eloquent\Model->getRelationValue('post')
#4 C:\xampp\htdocs\corcel\vendor\illuminate\database\Eloquent\Model.php(2604): Corcel\Model->getRelationValue('post')
#5 C:\xampp\htdocs\corcel\vendor\illuminate\database\Eloquent\Model.php(3392): Illuminate\Database\Eloquent\Model->getAttribute('post')
#6 C:\xampp\htdocs\corcel\tests\PostMetaTest.php(29): Illuminate\Database\Eloquent\Model->__get('post')
#7 [internal function]: PostMetaTest->testPostRelation()
#8 C:\xampp\htdocs\corcel\vendor\phpunit\phpunit\src\Framework in C:\xampp\htdocs\corcel\src\Model.php on line 39

Fatal error: Uncaught Error: Class 'Corcel\Str' not found in C:\xampp\htdocs\corcel\src\Model.php:39
Stack trace:
#0 C:\xampp\htdocs\corcel\src\PostMeta.php(32): Corcel\Model->belongsTo('Corcel\\Post')
#1 C:\xampp\htdocs\corcel\vendor\illuminate\database\Eloquent\Model.php(2689): Corcel\PostMeta->post()
#2 C:\xampp\htdocs\corcel\vendor\illuminate\database\Eloquent\Model.php(2662): Illuminate\Database\Eloquent\Model->getRelationshipFromMethod('post')
#3 C:\xampp\htdocs\corcel\src\Model.php(76): Illuminate\Database\Eloquent\Model->getRelationValue('post')
#4 C:\xampp\htdocs\corcel\vendor\illuminate\database\Eloquent\Model.php(2604): Corcel\Model->getRelationValue('post')
#5 C:\xampp\htdocs\corcel\vendor\illuminate\database\Eloquent\Model.php(3392): Illuminate\Database\Eloquent\Model->getAttribute('post')
#6 C:\xampp\htdocs\corcel\tests\PostMetaTest.php(29): Illuminate\Database\Eloquent\Model->__get('post')
#7 [internal function]: PostMetaTest->testPostRelation()
#8 C:\xampp\htdocs\corcel\vendor\phpunit\phpunit\src\Framework in C:\xampp\htdocs\corcel\src\Model.php on line 39

Process finished with exit code 255

I ran into this when using PostMeta, but this affects a lot of classes. I've got a fix for this with a test for the PostMeta class, which I'll raise as a pull request.

@jgrossi
Copy link
Member

jgrossi commented Mar 21, 2016

Thanks @mattKendon ;-) Fixed by #100

@jgrossi jgrossi closed this as completed Mar 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants