Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How can I testing of viewmodel?
  • Hello,

    I would like to test to viewmodel.But I can't find viewmodel in testcase.I tryed instantiate my viewmodel in testcase.That occured an error, because of viewmodel's contructor is protected.If there are some sample codes or sample posts, please tell me!

    Thanks,
  • Hi

    Welcome.

    I'd say have a look this page from the docs. I wasn't too sure about Viewmodels but now I'm confident using them in projects using Fuel because those docs were really helpful.

    Hopefully that'll get you started and you can continue from that. Don't forget a basic install of Fuel has a very basic viewmodel in the classes folder, you'll be able to add things there.

    I use Viewmodels to clean my logic from the controller that really doesn't need to be there that adjusts different view partials for example.

    Have fun! :)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion