Skip to content

Commit

Permalink
Merge pull request phalcon#1161 from phalcon/3.2.x
Browse files Browse the repository at this point in the history
3.2.x
  • Loading branch information
sergeyklay authored Jan 5, 2018
2 parents 3f18cbc + 0f526d5 commit f7d474a
Show file tree
Hide file tree
Showing 13 changed files with 123 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ This command should display something similar to:
```sh
$ phalcon --help

Phalcon DevTools (3.2.11)
Phalcon DevTools (3.2.12)

Help:
Lists the commands available in Phalcon devtools
Expand Down
2 changes: 1 addition & 1 deletion scripts/Phalcon/Builder/Scaffold.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ private function _makeLayoutsVolt()

$fileName = Text::uncamelize($this->options->get('fileName'));
$viewPath = $dirPathLayouts . DIRECTORY_SEPARATOR . $fileName . '.volt';
if (!file_exists($viewPath || $this->options->contains('force'))) {
if (!file_exists($viewPath) || $this->options->contains('force')) {

// View model layout
$code = '';
Expand Down
2 changes: 1 addition & 1 deletion scripts/Phalcon/Devtools/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ class Version extends PhVersion
*/
protected static function _getVersion()
{
return [3, 2, 11, 4, 0];
return [3, 2, 12, 4, 0];
}
}
3 changes: 2 additions & 1 deletion scripts/Phalcon/Generator/Snippet.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function getAttributes($type, $visibility, \Phalcon\Db\ColumnInterface $f
/**
*
* @var %s%s%s
* @Column(type="%s"%s, nullable=%s)
* @Column(column="%s", type="%s"%s, nullable=%s)
*/
%s \$%s;
EOD;
Expand All @@ -176,6 +176,7 @@ public function getAttributes($type, $visibility, \Phalcon\Db\ColumnInterface $f
$type,
$field->isPrimary() ? PHP_EOL.' * @Primary' : '',
$field->isAutoIncrement() ? PHP_EOL.' * @Identity' : '',
$field->getName(),
$type,
$field->getSize() ? ', length=' . $field->getSize() : '',
$field->isNotNull() ? 'false' : 'true', $visibility, $fieldName).PHP_EOL;
Expand Down
8 changes: 4 additions & 4 deletions tests/_data/console/app/models/files/TestModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ class TestModel extends \Phalcon\Mvc\Model
* @var integer
* @Primary
* @Identity
* @Column(type="integer", length=10, nullable=false)
* @Column(column="id", type="integer", length=10, nullable=false)
*/
public $id;

/**
*
* @var string
* @Column(type="string", length=20, nullable=false)
* @Column(column="some-col", type="string", length=20, nullable=false)
*/
public $someCol;

/**
*
* @var string
* @Column(type="string", length=20, nullable=false)
* @Column(column="someCol2", type="string", length=20, nullable=false)
*/
public $someCol2;

/**
*
* @var string
* @Column(type="string", length=20, nullable=false)
* @Column(column="SomeCol3", type="string", length=20, nullable=false)
*/
public $someCol3;

Expand Down
4 changes: 2 additions & 2 deletions tests/_data/console/app/models/files/TestModel2.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ class TestModel2 extends \Phalcon\Mvc\Model
* @var integer
* @Primary
* @Identity
* @Column(type="integer", length=10, nullable=false)
* @Column(column="id", type="integer", length=10, nullable=false)
*/
public $id;

/**
*
* @var string
* @Column(type="string", length=45, nullable=false)
* @Column(column="name", type="string", length=45, nullable=false)
*/
public $name;

Expand Down
4 changes: 2 additions & 2 deletions tests/_data/console/app/models/files/TestModel3.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ class TestModel3 extends \Phalcon\Mvc\Model
* @var integer
* @Primary
* @Identity
* @Column(type="integer", length=10, nullable=false)
* @Column(column="id", type="integer", length=10, nullable=false)
*/
public $id;

/**
*
* @var string
* @Column(type="string", length=45, nullable=false)
* @Column(column="name", type="string", length=45, nullable=false)
*/
public $name;

Expand Down
4 changes: 2 additions & 2 deletions tests/_data/console/app/models/files/Testmodel4.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ class Testmodel4 extends \Phalcon\Mvc\Model
* @var integer
* @Primary
* @Identity
* @Column(type="integer", length=10, nullable=false)
* @Column(column="id", type="integer", length=10, nullable=false)
*/
public $id;

/**
*
* @var string
* @Column(type="string", length=45, nullable=false)
* @Column(column="name", type="string", length=45, nullable=false)
*/
public $name;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1,test1,"2017-08-29 13:05:41","2017-08-29 13:05:41"
100 changes: 100 additions & 0 deletions tests/_data/console_data/run_mysql_migration/1.0.2/test_migrations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?php

use Phalcon\Db\Column;
use Phalcon\Db\Index;
use Phalcon\Db\Reference;
use Phalcon\Mvc\Model\Migration;

/**
* Class TestMigrationsMigration_101
*/
class TestMigrationsMigration_102 extends Migration
{
/**
* Define the table structure
*
* @return void
*/
public function morph()
{
$this->morphTable('test_migrations', [
'columns' => [
new Column(
'id',
[
'type' => Column::TYPE_INTEGER,
'unsigned' => true,
'notNull' => true,
'autoIncrement' => true,
'size' => 10,
'first' => true
]
),
new Column(
'name',
[
'type' => Column::TYPE_VARCHAR,
'notNull' => true,
'size' => 45,
'after' => 'id'
]
),
new Column(
'created_at',
[
'type' => Column::TYPE_DATETIME,
'notNull' => true,
'size' => 1,
'after' => 'name'
]
),
new Column(
'updated_at',
[
'type' => Column::TYPE_DATETIME,
'notNull' => true,
'size' => 1,
'after' => 'created_at'
]
)
],
'indexes' => [
new Index('PRIMARY', ['id'], 'PRIMARY')
],
'options' => [
'TABLE_TYPE' => 'BASE TABLE',
'AUTO_INCREMENT' => '2',
'ENGINE' => 'InnoDB',
'TABLE_COLLATION' => 'utf8_general_ci'
],
]
);
}

/**
* Run the migrations
*
* @return void
*/
public function up()
{
$this->batchInsert('test_migrations', [
'id',
'name',
'created_at',
'updated_at'
]
);
}

/**
* Reverse the migrations
*
* @return void
*/
public function down()
{
$this->batchDelete('test_migrations');
}

}
2 changes: 1 addition & 1 deletion tests/_support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
+------------------------------------------------------------------------+
| Phosphorum |
+------------------------------------------------------------------------+
| Copyright (c) 2013-2017 Phalcon Team and contributors |
| Copyright (c) 2013-present Phalcon Team and contributors |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file LICENSE.txt. |
Expand Down
1 change: 1 addition & 0 deletions tests/console/RunMysqlMigrationCept.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

$I->amInPath(dirname(app_path()));
$I->cleanDir(tests_path('_data/console/.phalcon'));
$I->copyDir(tests_path('_data/console_data/run_mysql_migration/1.0.2/'), app_path('migrations/1.0.2'));

$I->seeFileFound(app_path('migrations/1.0.2/test_migrations.php'));
$I->seeFileFound(app_path('migrations/1.0.2/test_migrations.dat'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
+------------------------------------------------------------------------+
| Phalcon Developer Tools |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2017 Phalcon Team (https://www.phalconphp.com) |
| Copyright (c) 2013-present Phalcon Team (https://www.phalconphp.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file LICENSE.txt. |
Expand Down Expand Up @@ -41,7 +41,10 @@ public function shouldReturnListTablesFromIterator()
$this->specify(
'Method' . __METHOD__ . 'did not return table list',
function($tablePrefix, $expected) use ($iterator, $listTables){
expect($listTables->listTablesForPrefix($tablePrefix, $iterator))->equals($expected);
$list = explode(',', $listTables->listTablesForPrefix($tablePrefix, $iterator));
natsort($list);

expect(implode(',', $list))->equals($expected);
},
[
'examples' => [
Expand Down

0 comments on commit f7d474a

Please sign in to comment.