脚本宝典收集整理的这篇文章主要介绍了php – 仅在使用Behat时发生语义错误,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用Symfony2.当我使用浏览器(firefox)手动访问页面时:
http://localhost:8000/vendor/add-PRoduct
页面呈现正常,我看到一个表单,允许用户将产品添加到他的商店.
namespace AppBundle\EntITy; use Doctrine\ORM\Mapping as ORM; use Symfony\component\Validator\Constraints as Assert; use Symfony\bridge\Doctrine\Validator\Constraints\uniqueEntity; /** * @ORM\Entity * @ORM\Table(name="app_products") */ class Product { /** * @ORM\Id * @ORM\Column(tyPE="integer") * @ORM\GeneratedValue(strategy="AUTO") */ private $productId; /** * @ORM\Column(type="integer") * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Store") */ private $storeid; /** * @ORM\Column(type="string",length=255) * @Assert\NotBlank(message="This is important,Product Name should not be blank!") * @Assert\Length(max = "255",maXMessage="Your description must not exceed 255 characters.") */ private $productName; /** * @ORM\Column(type="integer",length=255) * @Assert\GreaterThanOrEqual(value=0) * @Assert\NotBlank(message="Product Price should not be blank!") */ private $productPrice; /** * @ORM\Column(type="string",length=255) * @Assert\NotBlank(message="Please enter a product description.") * @Assert\Length(max = "255",maxMessage="Your description must not exceed 255 characters.") */ private $productDescription; /** * @ORM\Column(type="integer") * @Assert\GreaterThanOrEqual(value=0) * @Assert\NotBlank(message="Product Quantity should not be blank!") */ private $productQuantity; /** * @ORM\Column(type="string",length=255) * @Assert\File(mimeTypes={ "image/jpeg" }) * @Assert\File(maxSize="6000000") */ private $productImage; ...
这是我的特色:
Feature: Buying products As a customer,I want to view and select products before buying,So that I Could have more value for my money Background: Given I am on the homepage When I fill in "username" with "24thsaint" And I fill in "password" with "123123" And I Press "login-button" Scenario: Vendor wants to add a new product Given I am on the homepage When I follow "My Store" ###### The test stops here as I get the SEMantical Error And I follow "add-new-product"
请帮忙,我真的觉得一切都到位了.只是在使用Behat进行测试期间发生了错误.什么可能出错?
编辑:
我通过清除缓存做了先生Evgeniy Kuzmin的建议.我跑了,
PHP bin/console cache:clear --env=test
之前通过的测试现在失败,出现此错误:
[Semantical Error] The annotation "@Doctrine\ORM\Mapping\Entity" in class AppBundle\Entity\User does not exist,or Could not be auto-loaded.
请帮我.
以上是脚本宝典为你收集整理的php – 仅在使用Behat时发生语义错误全部内容,希望文章能够帮你解决php – 仅在使用Behat时发生语义错误所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。