У меня есть следующая особенность:
Scenario: Product page
Given there are the following products:
| id | name | price |
| 1 | Test product | 100 |
When I am on "/product/view/1"
Then the main page title should be "Test product"
Теперь я использую Symfony с Doctrine. Итак, в моем классе контекста я не могу этого сделать:
/**
* @Given /^there are the following products:$/
*/
public function createProducts(TableNode $products)
{
$hash = $users->getHash();
foreach ($hash as $row) {
// Create our user and set details
$product = new Product();
$product->setId($row['id']); // <= This method doesn't exist
$product->setName($row['name']);
$product->setPrice($row['price']);
// Persist product...
}
}
Метода setId не существует, и создавать его не очень хорошая идея. Итак, мой вопрос: есть ли способ проверить это?