CakeDC / ratings

Ratings Plugin for CakePHP
http://cakedc.com
Other
71 stars 21 forks source link

Ratings fails on redirect #17

Closed larry-tx closed 11 years ago

larry-tx commented 11 years ago

I'm trying to implement the current version of Ratings in CakePHP 2.2.7, and it fails when I try to submit a rating. The URL (using my resources_controller) that the submit goes to is:

 http://lel.lcl/admin/resources/view/redirect:1

The actual id of the record that I'm trying to rate is 28, not 1, but more importantly, I'm using findBySlug instead of findById in the admin_view action.

I've got this in my model:

 public $actsAs = array(
        'Search.Searchable',
        'Utils.Sluggable' => array(
            'label'  => 'name',
            'slug'   => 'slug',
            'update' => FALSE,
        ),
        'Ratings.Ratable',
        'Containable'
    );

I've got this in my controller:

 public $helpers = array('Ratings.Rating');

And, I've got this in my admin_view.ctp:

 <?php
echo $this->Rating->display(array(
                                 'item' => $resource['Resource']['slug'],
                                 'type' => 'radio',
                                 'stars' => 5,
                                 'value' => $item['rating'],
                                 'createForm' => array('url' => array($this->passedArgs, 'rate' => $item['id'], 'redirect' => true))));

?>

The specific error produced is:

 Error: The requested address '/admin/resources/view/redirect:1' was not found on this server.

How can I get this plugin to perform as expected?

burzum commented 11 years ago

Please provide a unit test for the failing scenario. Without a unit test I'll close the ticket in a week.

larry-tx commented 11 years ago

So now, I have to figure out how to do a unit test on your plugin. This is the problem with CakePHP. It's a framework for developers to spend enormous amounts of time to tinker with it on a highly technical level solely and explicitly because they enjoy the challenges that it presents with virtually no support to those who aren't at a high level. Forget the notion that frameworks are supposed to simplify and speed up the development process. Now, we have to develop unit tests for everything that doesn't work. CakePHP is highly technical for highly technical folks who have little to nothing better to do. Sorry, I've spent way too much time on this already. If you can't provide good quality instructions that work, well, I guess it's just not worth it.

burzum commented 11 years ago

Every framework (RoR, ZF, Smyfony, Flow3...) and every professional developer uses unit tests to verify his code works. If you have to learn how to unit test something (Its basically the same in any programming language and framework) see it as an opportunity to fill a gap in your education.

After reviewing two tickets that show after review that your code seems to be the problem I demand a unit test from you before spending more unpaid time on solving your problems. Proof that the plugin code is failing by a unit test and not your code and I'll fix it. As a programmer you should know about http://en.wikipedia.org/wiki/Test-driven_development. Writing a test is very often less time consuming than wasting hours with trial and error.

And finally, you get here excellent, unit tested code for free and complain that we do not give you support for free to solve your problems? Come on, that's pretty ballsy. I won't review any of your tickets any more as long as they do not come with an unit test. If you don't like to pay for solving your problem nor the plugin code we give you for free it is open to you to write your own plugins if you think you can do better and faster, and you won't have to worry about evil unit tests.

larry-tx commented 11 years ago

A.) You might want to take a look at your unit tests. See attached images. Your test cases do not conform to PHPUnit and CakeTestCase. I ran the tests just as they come with the Ratings plugin with no modification whatsoever. B.) I do use unit tests. However, I use unit tests for things that I develop. When I get something that is supposed to be professionally done by a professional company, I expect that it will work as described. These plugins are your own worst advertisement. I can just see hiring you to deliver a product. Here's the scenario: You deliver the product, it doesn't work, you tell me to figure out what's wrong and you'll fix it. Is that how CakeDC does its work? C.) My code "seems" to be the problem. The only thing you've shown me is that, as is widely publicized on Internet sites such as StackOverflow, CakeDC's documentation (when there is any) is deplorable. Once again, thorough, detailed, accurate documentation is the hallmark of a professional developer. Again take a look at these images. cakephp test suite 2 2 - ratings_page_20 cakephp test suite 2 2 - ratings_page_21 cakephp test suite 2 2 - ratings_page_22 cakephp test suite 2 2 - ratings_page_23 cakephp test suite 2 2 - ratings_page_01 cakephp test suite 2 2 - ratings_page_02 cakephp test suite 2 2 - ratings_page_03 cakephp test suite 2 2 - ratings_page_05 cakephp test suite 2 2 - ratings_page_06 cakephp test suite 2 2 - ratings_page_07 cakephp test suite 2 2 - ratings_page_08 cakephp test suite 2 2 - ratings_page_09 cakephp test suite 2 2 - ratings_page_10 cakephp test suite 2 2 - ratings_page_11 cakephp test suite 2 2 - ratings_page_12 cakephp test suite 2 2 - ratings_page_13 cakephp test suite 2 2 - ratings_page_14 cakephp test suite 2 2 - ratings_page_15 cakephp test suite 2 2 - ratings_page_16 cakephp test suite 2 2 - ratings_page_17 cakephp test suite 2 2 - ratings_page_18 cakephp test suite 2 2 - ratings_page_19 cakephp test suite 2 2 - ratings_page_04

burzum commented 11 years ago

A) Well, my apologies, must have run the test for one of your other tickets on another plugin. However, I've updated the tests to work with 5.4 and checked that your case is there. It seems to be covered, overall the code coverage is good. You know that you can run the tests via command line? No need for screenshots.

←[30;42m←[2KOK (34 tests, 109 assertions) ←[0m←[2K

B) You usually write also tests for your methods that integrat 3rd party libs and verify they work. This plugin is not a product but this is open source. There is a huge difference.

We give code back to the community for free (MIT license) you can even build a commercial product with this code. This is a gift to the community, to you, and no advertising. Open source works through contribution and not by demanding something. Based on the amount of code we have you now demand to keep all of them completely up to date - for free? Contribute instead by updating and adding tests if there is something missing.

However, I've made all tests pass and your case is for my understanding covered by the tests. If not you're welcome to proof me wrong by adding your scenario that demonstrates the failure.

C) Most plugins have documentation and by reading the code you can figure out what it does. If you think documentation is missing you're welcome to join the open source community and contribute your share to the documentation. Thank you!

burzum commented 11 years ago

Accidentally closed it, I'll wait for more information and an unit test before closing it.

burzum commented 11 years ago

Closing this now because there is no more feedback or unit test provided.

larry-tx commented 11 years ago

Sorry I didn't respond to you on this. After spending a huge amount of time trying to make Cake work, I've come to the conclusion that it's still a very immature product, not ready for realistic production work in a complex environment. After doing much research, I'm going with Yii. There's a reason why Yii has exceeded Cake in usage rates. It has a large number of alternative extensions (with a large variety of developers, not just one primary one like Cake), a robust, very helpful user community, and excellent documentation -- all areas in which Cake is sorely lacking.

It's a difficult choice for me because I really like the Cake way of doing things, but after all this time, Cake has still not matured. It looks like it never will, and it will certainly be overtaken by several other frameworks. What a shame.

burzum commented 11 years ago

If you think so good luck with Yii. I disagree about it, its lacking a few things like better request handling for example. Also I don't like the static calls of models inside controllers, same for the helpers. Testing must be fun there. Just by looking at the blog tutorial I see several things CakePHP does better. Worst thing is that it mentions that this code was generated by Yiis equivalent of bake. This here for example is insecure http://www.yiiplayground.com/index.php?r=UiModule/ui_other/starRating. Same about the silly never ending framework benchmark story. Together with Jose we've took the 1/4 hour and outperformed Yiis glory benchmark - using CakePHP - just to show how pointless it was.

But can you explain what is wrong with book.cakephp.org and api.cakephp.org? The documentation is excellent and complete. People just need to read and follow it. Can you name something in particular that is missing or incomplete? Cake has a very active Google Group, an IRC Channel to get help from, at least others do so.