由于自动加载器无法解析Doctrine\ORM\Mapping\Table,因此我很难对作曲家进行自动加载.对于Unittests,我创建了带有典型Annotations的doctrine实体类:
<?php
namespace OmniSearchTest\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Picture
*
* @ORM\Table(name="picture")
* @ORM\Entity
*/
class Picture
{
Run Code Online (Sandbox Code Playgroud)
并使用此实体创建了一个新的实体管理器.但我收到消息:
Doctrine\Common\Annotations\AnnotationException: [Semantical Error] The annotation "@Doctrine\ORM\Mapping\Table" in class OmniSearchTest\Entity\Picture does not exist, or could not be auto-loaded.
Run Code Online (Sandbox Code Playgroud)
对于一些Unittests
首先,我有以下项目结构:
/src
/OmniSearch
SomeClass.php
/tests
/OmniSearchTest
SomeClassTest.php
/composer.json
/phpunit.xml.dist
Run Code Online (Sandbox Code Playgroud)
我的composer.json看起来像这样:
{
/* ... */
"require": {
"php": ">=5.4",
"doctrine/orm": "2.*"
},
"require-dev": {
"phpunit/phpunit": "4.*"
},
"autoload": {
"psr-0": {
"OmniSearch\\": "src/"
}
},
"autoload-dev": {
"psr-0": {
"OmniSearchTest\\": "tests/"
} …Run Code Online (Sandbox Code Playgroud) 我正在寻找一种同时配置多个测试目录的方法。这是我目前的配置
sonar.sources=src
sonar.tests=src/Acme/Bundle/DemoBundle/Tests,src/Acme/Bundle/DatabaseBundle/Tests
sonar.phpUnit.configuration=app/phpunit.xml.dist
sonar.php.tests.reportPath=build/logs/junit.xml
sonar.php.coverage.reportPath=build/logs/clover.xml
sonar.libraries=vendor
sonar.language=php
Run Code Online (Sandbox Code Playgroud)
问题是,有没有办法为 sonar.tests 定义路径,例如
src/**/Tests
Run Code Online (Sandbox Code Playgroud)
声纳停止并出现以下错误:
The folder 'src/**/Tests' does not exist for DemoProject
Run Code Online (Sandbox Code Playgroud) 我正在使用Doctrine 2和ZF2以及Doctrine-Module.我写了一个需要PreUpdate | PrePersist的实体,因为Doctrine不允许在主键中使用Date | Datetime:
<?php
namespace Application\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
*
* @ORM\Entity
* @ORM\HasLifecycleCallbacks
* @ORM\Table(name="sample")
*/
class Sample
{
/**
*
* @ORM\Id
* @ORM\Column(type="string")
* @var integer
*/
protected $runmode;
/**
*
* @ORM\Id
* @ORM\Column(type="date")
* @var DateTime
*/
protected $date;
public function getRunmode()
{
return $this->runmode;
}
public function setRunmode($runmode)
{
$this->runmode = $runmode;
return $this;
}
public function getDate()
{
return $this->date;
}
public function setDate($date)
{
$this->date = $date; …Run Code Online (Sandbox Code Playgroud)