Comments (8)
@tonydspaniard this issue is not fixed yet. why do you close it?
from yii2-app-template.
@pana1990 speed reviewing...
from yii2-app-template.
@pana1990 when you create a new migration, you should run composer update
as it heavily relies on composer autoloader
. Have you done the composer update
so it recreates its class names?
from yii2-app-template.
i think that the problem is missing @tests alias.
i am going to try again explain the problem :
1º i create fresh project with composer.
2º i create the following migration :
<?php
use yii\db\Migration;
/**
* Handles the creation of table `post`.
*/
class m170731_035905_create_post_table extends Migration
{
/**
* @inheritdoc
*/
public function up()
{
$this->createTable('post', [
'id' => $this->primaryKey(),
'title' => $this->string(),
'content' => $this->text(),
]);
}
/**
* @inheritdoc
*/
public function down()
{
$this->dropTable('post');
}
}
3º run yii migrate // it works.
4º i create the following fixture in tests/fixtures/PostFixture.php
<?php
namespace tests\fixtures;
class PostFixture extends ActiveFixture
{
public $modelClass = 'app\models\Post';
}
5º i create data to postfixture in tests/fixtures/data/post.php
<?php
return [
[
'id' => 1,
'title' => 'title 1',
'content' => 'content 1',
],
[
'id' => 2,
'title' => 'title 2',
'content' => 'content 2',
],
];
6º i config controllerMap to custom my namespace fixture in config/console/app.php
'controllerMap' => [
'fixture' => [
'class' => 'yii\console\controllers\FixtureController',
'namespace' => 'tests\fixtures',
],
]
7º i run yii fixture "*" and this command fails :
if i add the following alias it works :
<?php
use SideKit\Config\ConfigKit;
/*
* --------------------------------------------------------------------------
* Register custom Yii aliases
* --------------------------------------------------------------------------
*
* As we have changed the structure. Modify default Yii aliases here.
*/
Yii::setAlias('@tests', ConfigKit::config()->getBasePath() . DIRECTORY_SEPARATOR . '../tests');
Yii::setAlias('@root', ConfigKit::config()->getRootPath());
Yii::setAlias('@web', ConfigKit::config()->getBasePath() . DIRECTORY_SEPARATOR . '../public');
Maybe it's better include this alias in config console, can i send pr to fix this issue?
from yii2-app-template.
@pana1990 you are totally correct. I don't think the @tests
alias could damage anyhow the rest of the app. So I think bootstrap/aliases.php
is the best place to add it. Please, proceed (do not forget to add that change on CHANGE_LOG.
Thanks you for your work on this template.
from yii2-app-template.
On another note, shouldn't you be using $ ./tests/bin/yii
instead?
from yii2-app-template.
if i want to seed my dev db i need to use yii, isn't it?
from yii2-app-template.
I use database dumps: http://codeception.com/docs/modules/Db
from yii2-app-template.
Related Issues (20)
- [Docs] How to configure a module with a config file? HOT 3
- Enviroment tests HOT 2
- Switched to asset-packagist.org
- add alias @root HOT 2
- autoload src sugestion name HOT 3
- Consider using require as a statement, not a function
- Add yii2-shell by default HOT 4
- Composer scripts HOT 1
- [ENH] Add vars in env to mailer config HOT 1
- Structure models HOT 1
- Skinny models, controllers and views - but fat what? HOT 3
- When app template using CofigKit 2.0 HOT 2
- The file or directory to be published does not exist: ../vendor/bower/jquery/dist HOT 1
- Can't install it following the first command
- Cannot use 'Object' as class name as it is reserved
- Yii::$app->params
- manage events
- Tests not passed HOT 1
- Too many dependencies HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2-app-template.