forked from phalcon/phalcon-devtools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request phalcon#1102 from phalcon/3.2.x
3.2.5
- Loading branch information
Showing
39 changed files
with
1,929 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
/* | ||
+------------------------------------------------------------------------+ | ||
| Phalcon Developer Tools | | ||
+------------------------------------------------------------------------+ | ||
| Copyright (c) 2011-2016 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. | | ||
| | | ||
| If you did not receive a copy of the license and are unable to | | ||
| obtain it through the world-wide-web, please send an email | | ||
| to [email protected] so we can send you a copy immediately. | | ||
+------------------------------------------------------------------------+ | ||
| Authors: Sergii Svyrydenko <[email protected]> | | ||
+------------------------------------------------------------------------+ | ||
*/ | ||
|
||
namespace Phalcon\Utils; | ||
|
||
class Nullify | ||
{ | ||
public function __invoke($values) | ||
{ | ||
$vals = array_map( | ||
function ($value) { | ||
if (function_exists('mb_strtolower')){ | ||
return mb_strtolower($value); | ||
} | ||
}, | ||
$values | ||
); | ||
|
||
foreach ($vals as $key => $value) { | ||
if ($value == 'null'){ | ||
$values[$key] = null; | ||
} | ||
} | ||
|
||
return $values; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
use Phalcon\Config; | ||
use Phalcon\Logger; | ||
|
||
return new Config([ | ||
'database' => [ | ||
'adapter' => 'Postgresql', | ||
'host' => env('TEST_DB_POSTGRESQL_HOST', '127.0.0.1'), | ||
'username' => env('TEST_DB_POSTGRESQL_USER', 'postgres'), | ||
'password' => env('TEST_DB_POSTGRESQL_PASSWD', ''), | ||
'dbname' => env('TEST_DB_POSTGRESQL_NAME', 'devtools'), | ||
'schema' => env('TEST_DB_POSTGRESQL_SCHEMA', 'public') | ||
], | ||
'logger' => [ | ||
'path' => tests_path('_output/logs/console/postgresql/'), | ||
'format' => '%date% [%type%] %message%', | ||
'date' => 'D j H:i:s', | ||
'logLevel' => Logger::DEBUG, | ||
'filename' => 'tests.log', | ||
] | ||
]); |
Empty file.
124 changes: 124 additions & 0 deletions
124
tests/_data/console/app/test_insert_delete/migrations/1.0.0/test_insert_delete.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<?php | ||
|
||
use Phalcon\Db\Column; | ||
use Phalcon\Db\Index; | ||
use Phalcon\Db\Reference; | ||
use Phalcon\Mvc\Model\Migration; | ||
|
||
/** | ||
* Class TestInsertDeleteMigration_100 | ||
*/ | ||
class TestInsertDeleteMigration_100 extends Migration | ||
{ | ||
/** | ||
* Define the table structure | ||
* | ||
* @return void | ||
*/ | ||
public function morph() | ||
{ | ||
$this->morphTable('test_insert_delete', [ | ||
'columns' => [ | ||
new Column( | ||
'id', | ||
[ | ||
'type' => Column::TYPE_INTEGER, | ||
'notNull' => true, | ||
'autoIncrement' => true, | ||
'first' => true | ||
] | ||
), | ||
new Column( | ||
'login_type_id', | ||
[ | ||
'type' => Column::TYPE_INTEGER, | ||
'notNull' => true, | ||
'after' => 'id' | ||
] | ||
), | ||
new Column( | ||
'username', | ||
[ | ||
'type' => Column::TYPE_VARCHAR, | ||
'notNull' => true, | ||
'size' => 255, | ||
'after' => 'login_type_id' | ||
] | ||
), | ||
new Column( | ||
'name', | ||
[ | ||
'type' => Column::TYPE_VARCHAR, | ||
'notNull' => true, | ||
'size' => 255, | ||
'after' => 'username' | ||
] | ||
), | ||
new Column( | ||
'email_addr', | ||
[ | ||
'type' => Column::TYPE_VARCHAR, | ||
'notNull' => true, | ||
'size' => 255, | ||
'after' => 'name' | ||
] | ||
), | ||
new Column( | ||
'password', | ||
[ | ||
'type' => Column::TYPE_VARCHAR, | ||
'notNull' => true, | ||
'size' => 255, | ||
'after' => 'email_addr' | ||
] | ||
), | ||
new Column( | ||
'phone_num', | ||
[ | ||
'type' => Column::TYPE_BIGINTEGER, | ||
'after' => 'password' | ||
] | ||
), | ||
new Column( | ||
'token_id', | ||
[ | ||
'type' => Column::TYPE_BIGINTEGER, | ||
'after' => 'phone_num' | ||
] | ||
) | ||
], | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* Run the migrations | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
$this->batchInsert('test_insert_delete', [ | ||
'id', | ||
'login_type_id', | ||
'username', | ||
'name', | ||
'email_addr', | ||
'password', | ||
'phone_num', | ||
'token_id' | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* Reverse the migrations | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
$this->batchDelete('test_insert_delete'); | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
tests/_data/console/app/test_insert_delete/migrations/1.0.1/test_insert_delete.dat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1,1,superadmin1,"First name Last name",[email protected],,1,NULL |
Oops, something went wrong.