Rhino Mocks step-by-step tutorials - tdd

I realise that there exist some posts such as this one which have asked the same question. However, the links on the suggested page do not work (it simply takes me back to the blog homepage).
I'm looking for a tutorial which does not have any assumed prior Rhino Mocks knowledge.
I need a step-by-step guide which explains the basics (stubs vs. mocks vs. expect.call), how the Record(), ReplayAll(), VerifyAll(), when/why you use Repeat.Any() etc., work.
I have a rough understanding after reading some of the documentation (which I found some articles to be useful, but most to be confusing at best), but I need some more examples with detailed explanations on how to use Rhino Mocks.

I think the best links, which are both up to date, and starting from the basics are:
Getting Started with Rhino Mocks (AAA)
Using Rhino.Mocks - quick guide to generating mocks and stubs

Related

Is it a good practice to extend a zf2 controller twice?

I Searched a lot to find the answer to this question, here on stackoverflow and over on google. But was not able to find anything...
So, my question is: It is a good practice to extend a controller (in my case BaseUserController from zfcuser) once in a module, and once more in another module?
Thanks for all your replies!
It's fine, I would not go as far as "good practice".
Excessive use of inheritance can cause you issues in any language and there are numerous of post around explaining the issues and possible solutions.
From a ZF2 perspective in doing so you will have the issue where Module B depends on Module A which may be a problem - However this really depends your application/module design.
There are other alternatives:
Aggregation -
create new functionality by taking other classes and combining them into a new class. Attach an common interface to this new class for interoperability with other code.
Use PHP traits - If you lucky enough to use the more recent versions of (PHP 5.4+) the you can simply reuse these within each controller class that requires it.
A Custom Controller Plugin - ZF2 has a "pluggable" API within the controller, meaning you can write self contained helper classes that can then be used in any controller - No need to extend. You are almost certainly using these already with $this->redirect() or $this->params() so they might be good places to start to see how they are built.

RESTful Application with MVC Architecture

Ok. So for school, we need to make a mobile app that works with a RESTful api that is programmed through a MVC architecture. I do know how the MVC architecture works, but I really don't understand how the RESTful thing works...
From what I've looked up (and asked around), I think to have understood that when you have a Restful application, A JSON string should be reproduced when you type a certain URL. For example 'www.website.com/users' should give me a list of all the users. 'www.website.com/users/johndoe' should give me the userpage of John Doe.
However... I don't know how to begin with this... This is the example our teacher showed us (so that's how it should be done). I just don't understand how you would give a certain layout to these pages.
Is there anyone that would be willing to take a look at this and explain it to me. I'm kinda desperate...
Thanks in advance,
HS.
I wrote a detailed post on the topic with lots of examples, which may be helpful:
http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api

How to implement authentication in ZF2

There are a couple of examples online about how to write plugins implementing authentication in Zend Framework 2, but no clear information on how to use them in an application. Does anyone have a working (complete) ZF2 app that implements a simple login screen?
Check this out:
http://blog.evan.pro/getting-started-with-the-zf2-skeleton-and-zfcuser
it's a good example of how to get the standard skeleton application to work with the zfcUser module to provide exactly what you need.
I think this will be helpful:
http://samsonasik.wordpress.com/2012/10/23/zend-framework-2-create-login-authentication-using-authenticationservice-with-rememberme/
http://framework.zend.com/manual/2.0/en/modules/zend.authentication.intro.html
Start with that....i was sailing in the same boat as you were when i started off.. I did not use zfcuser as i thought it was complicated for me to use in the small amount of time i had. But its the best way of doing it.
Check the wiki page for zfc user as well.
But you can do things really simple with zf2 authentication rather than writing your own module for it.

User login/session system description

I'm building my first web app, and I've got all these crazy ideas on ways I could handle things like logins/sessions, but I was wondering if anyone has written a really good, thorough description of how logins/sessions work. I've seen tutorials, but I want to know if theres something more abstract that gives the reader a more general idea of how the whole process is handled. My web app is in ruby/sinatra if that's relevant.
Most of the in-depth tutorials for login/authentication from scratch are for Rails unfortunately. I went through the same trouble trying to find Sinatra specific tutorials. I would recommend just checking out the rails oriented tutorials since the knowledge is pretty general and can be applied to Sinatra as well.
These guides from RailsGuides are pretty good for getting an understanding of authentication even though they are Rails specific (read the section on security especially):
http://guides.rubyonrails.org/
Here's an example of a good Sinatra authentication scheme on github (it uses the datamapper gem, but you can easily replace this with any other Ruby ORM):
https://github.com/daddz/sinatra-dm-login
If you aren't as interested in rolling your own, you can also try the sinatra-authentication gem:
https://github.com/maxjustus/sinatra-authentication

Learning Inversion of Control through Dependency Injection in MVC 3

Can someone please provide me a simple example of DI and IoC?
I understand the first one but was unable to get an implementation of the second one.
I'm working with MVC 3 and I really want to use the IDependencyResolver, but I can't understand how.
Is ninject an option or is it required?
Is there a tutorial like nerdDinner and I wasn't able to find it?
Can somebody give me a link to study it?
In order to grok real world DI and its patterns and anti-patterns quickly, I recommend getting DI in .NET. (I've ordered it already EDIT: And it was a page turner that taught me a lot and should teach people of all experience levels well)
Failing that, read all Mark Seemann's high-rated posts here.
I personally learned from the ninject wiki, but that, while excellent, is Ninject 1.0 specific.
don't use IDependencyResolver. It has nothing to do with Inversion of Control, and it's fundamentally broken. If you want to learn how to use IoC Container properly with MVC 3 see this tutorial (uses Windsor).
This isn't my example, but is one I just ran across while looking for a simple, functional example. It uses NInject and the final IoC functionality of .Net MVC 3.
http://www.shahnawazk.com/2010/12/dependency-injection-in-aspnet-mvc-3.html
Simple downloadable example project at the bottom of the article.
I cant answer for asp related techs, but on the academic side, the fact that you are using DI implies that you have inverted control.
Ill make it explicit -- when you do not invert control, you basically make the various components of an application resolve their own dependencies. When you invert control, you allow the resolving of the dependencies happen at some other layer. That is the 'inversion' of the control.

Resources