Code Monkey home page Code Monkey logo

Comments (21)

franzose avatar franzose commented on June 11, 2024

Strange, I use phpunit, as laravel says, and no errors appear.

from closuretable.

vjandrea avatar vjandrea commented on June 11, 2024

I have two ClosureTable folders, one inside a laravel project that i update via composer to your repo, one in my documents folder, and in both cases i get the same errors.
htdocs: http://paste.laravel.com/WRv
documents: http://paste.laravel.com/WRw

OSX 10.7.5 / macbookpro
PHP version: 5.4.10 (MAMP)
PHPunit version: 3.7.27

Dependencies installed through composer (identical in both folders)

  illuminate/container 4.0.x-dev ee86c89 
  illuminate/database  4.0.x-dev 64c9e48 
  illuminate/events    4.0.x-dev 2253c8c 
  illuminate/support   4.0.x-dev bec895e 
  nesbot/carbon        1.4.0             A simple API extension for DateTime.

If you need more info let me know!

from closuretable.

vjandrea avatar vjandrea commented on June 11, 2024

Updated php to 5.5.3, errors persist. I don't know where i should bang my head on. I'm going to setup a vm with vagrant to test on linux.

from closuretable.

vjandrea avatar vjandrea commented on June 11, 2024

I did further tests on a vm created with vagrant from this repo: https://github.com/bryannielsen/Laravel4-Vagrant and i still get all 34 errors: http://paste.laravel.com/WV4

from closuretable.

franzose avatar franzose commented on June 11, 2024

My setup is Mac OS X 10.7.5 and I don't use virtual machine. PHP is:

PHP 5.4.16 (cli) (built: Jun 15 2013 04:04:59) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with Xdebug v2.2.2, Copyright (c) 2002-2013, by Derick Rethans

PHPUnit 3.7.21 by Sebastian Bergmann.

from closuretable.

franzose avatar franzose commented on June 11, 2024

Line 544 is where $this->getKey() is called, hm...

from closuretable.

vjandrea avatar vjandrea commented on June 11, 2024

What makes me think is that before the last call to $this->prepareTestedSiblings(), it stops on line 70, at the end of this:

$child = $page->appendChild(Page::make(array(
            'title' => 'Child Page Test Title',
            'excerpt' => 'Child Page Test Excerpt',
            'content' => 'Child Page Test content',
            'language' => 'en'
        )), 0, true);

or on line 117, at the end of this:

$child1 = $page->appendChild(Page::make(array(
            'title' => 'Test Title',
            'excerpt' => 'Test Excerpt',
            'content' => 'Test content',
            'language' => 'en'
        )), 0, true);

from closuretable.

vjandrea avatar vjandrea commented on June 11, 2024

Tried on Windows 7 32bit (MINGW32_NT-6.1) as well, PHP 5.5.4 (cli), PHPUnit 3.7.27, i still get all 34 errors:
http://paste.laravel.com/X44

from closuretable.

franzose avatar franzose commented on June 11, 2024

How have you sped, Andea?

from closuretable.

vjandrea avatar vjandrea commented on June 11, 2024

@franzose, nothing new at the moment, i tried to write other tests for prepareTestedSiblings() but i always get the InvalidArgumentException. I am now studying a bit phpunit API to see if i can make it spit out a more detailed log, because 'Value must be provided' is not really helpful as hint. By the way, did you manage to see the errors in your phpunit?

from closuretable.

franzose avatar franzose commented on June 11, 2024

@vjandrea, and now, you wouldn't believe, I've got the same 34 errors! great. So, now it's a problem of both of us :D

from closuretable.

franzose avatar franzose commented on June 11, 2024

And I know the reason.

from closuretable.

franzose avatar franzose commented on June 11, 2024

@vjandrea, when we call Entity::make(), it tries to guess and set the position if not provided by this: $model->guessPositionOnCreate();. What do we see inside that method? Yes, we see $this->hasSiblings() and $this->lastSibling() calls. Exception is thrown right after $this->hasSiblings() call because... The query is built by buildSiblingsQuery() and buildSiblingsSubquery() methods. The latter requires id of the model. But the model doesn't have it yet because hasn't been saved into the database!

from closuretable.

franzose avatar franzose commented on June 11, 2024

We have to change somehow the way position is guessed.

from closuretable.

vjandrea avatar vjandrea commented on June 11, 2024

Amazing! Now i know where i should bang my head on! I'm trying to figure out something.

from closuretable.

vjandrea avatar vjandrea commented on June 11, 2024

So, what if we put a check in hasSiblings() that returns false if the id is not set? I think we should avoid the creation of the query in that case.

from closuretable.

franzose avatar franzose commented on June 11, 2024

@vjandrea, I think that can break things. Now I'm trying to assume that when we make(), we can set position to 0 as well as the depth. Part of errors are gone after that, but still there's 5.

from closuretable.

vjandrea avatar vjandrea commented on June 11, 2024

@franzose that's great! Do you mind pasting the error dump of the remaining 5, or create a hotfix branch with your edit that i can pull to test?

from closuretable.

franzose avatar franzose commented on June 11, 2024

@vjandrea, aaaaaaaaarrgghhhhhh! Sorry, but it's fucking great. I have solved problems with siblings at last! Sorry, but you'll need to update your repository and merge with your changes.

from closuretable.

vjandrea avatar vjandrea commented on June 11, 2024

Brilliant job, @franzose!

from closuretable.

franzose avatar franzose commented on June 11, 2024

@vjandrea thanks, however I suppose that there's still problem with the position column. I will discover that a little later.

from closuretable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.