Answer the question
In order to leave comments, you need to log in
Testing cart functionality?
I see that in order to test this functionality, I need 3 levels of the
1st to test the objects themselves
$product = new Product(123);
$basket->add($product)
assert ( instanceof $basket->get(123) == \namespace\Product );
$basket->remove( 123 );
assert( false === $basket->getAll() )
$crawler = $client->request(‘POST’, “/basket/add” );
$form = $crawler->filter('#formID')->form();
$form->setValues(array(
"form[productId]” => 123,
"form[quontity]” => 4
));
$response = $client->getResponse();
// assert status code
$crawler = $client->request('GET', “/basket/getAll” );
$response = $client->getResponse();
// foreach basketItems и найти положеный ProductId
$crawler = $client->request('GET', “/basket/delete/123” );
$response = $client->getResponse();
// check status code и повторить /basket/getAll проверить что продукт удалился
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question