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#1145 from phalcon/3.2.x
v3.2.11
- Loading branch information
Showing
11 changed files
with
374 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
|
||
class TestModel extends \Phalcon\Mvc\Model | ||
{ | ||
|
||
/** | ||
* | ||
* @var integer | ||
* @Primary | ||
* @Identity | ||
* @Column(type="integer", length=10, nullable=false) | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* | ||
* @var string | ||
* @Column(type="string", length=20, nullable=false) | ||
*/ | ||
public $someCol; | ||
|
||
/** | ||
* | ||
* @var string | ||
* @Column(type="string", length=20, nullable=false) | ||
*/ | ||
public $someCol2; | ||
|
||
/** | ||
* | ||
* @var string | ||
* @Column(type="string", length=20, nullable=false) | ||
*/ | ||
public $someCol3; | ||
|
||
/** | ||
* Initialize method for model. | ||
*/ | ||
public function initialize() | ||
{ | ||
$this->setSchema("devtools"); | ||
$this->setSource("testModel"); | ||
} | ||
|
||
/** | ||
* Returns table name mapped in the model. | ||
* | ||
* @return string | ||
*/ | ||
public function getSource() | ||
{ | ||
return 'testModel'; | ||
} | ||
|
||
/** | ||
* Allows to query a set of records that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return TestModel[]|TestModel|\Phalcon\Mvc\Model\ResultSetInterface | ||
*/ | ||
public static function find($parameters = null) | ||
{ | ||
return parent::find($parameters); | ||
} | ||
|
||
/** | ||
* Allows to query the first record that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return TestModel|\Phalcon\Mvc\Model\ResultInterface | ||
*/ | ||
public static function findFirst($parameters = null) | ||
{ | ||
return parent::findFirst($parameters); | ||
} | ||
|
||
} |
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,63 @@ | ||
<?php | ||
|
||
class TestModel2 extends \Phalcon\Mvc\Model | ||
{ | ||
|
||
/** | ||
* | ||
* @var integer | ||
* @Primary | ||
* @Identity | ||
* @Column(type="integer", length=10, nullable=false) | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* | ||
* @var string | ||
* @Column(type="string", length=45, nullable=false) | ||
*/ | ||
public $name; | ||
|
||
/** | ||
* Initialize method for model. | ||
*/ | ||
public function initialize() | ||
{ | ||
$this->setSchema("devtools"); | ||
$this->setSource("test-model2"); | ||
} | ||
|
||
/** | ||
* Returns table name mapped in the model. | ||
* | ||
* @return string | ||
*/ | ||
public function getSource() | ||
{ | ||
return 'test-model2'; | ||
} | ||
|
||
/** | ||
* Allows to query a set of records that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return TestModel2[]|TestModel2|\Phalcon\Mvc\Model\ResultSetInterface | ||
*/ | ||
public static function find($parameters = null) | ||
{ | ||
return parent::find($parameters); | ||
} | ||
|
||
/** | ||
* Allows to query the first record that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return TestModel2|\Phalcon\Mvc\Model\ResultInterface | ||
*/ | ||
public static function findFirst($parameters = null) | ||
{ | ||
return parent::findFirst($parameters); | ||
} | ||
|
||
} |
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,63 @@ | ||
<?php | ||
|
||
class TestModel3 extends \Phalcon\Mvc\Model | ||
{ | ||
|
||
/** | ||
* | ||
* @var integer | ||
* @Primary | ||
* @Identity | ||
* @Column(type="integer", length=10, nullable=false) | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* | ||
* @var string | ||
* @Column(type="string", length=45, nullable=false) | ||
*/ | ||
public $name; | ||
|
||
/** | ||
* Initialize method for model. | ||
*/ | ||
public function initialize() | ||
{ | ||
$this->setSchema("devtools"); | ||
$this->setSource("test_model3"); | ||
} | ||
|
||
/** | ||
* Returns table name mapped in the model. | ||
* | ||
* @return string | ||
*/ | ||
public function getSource() | ||
{ | ||
return 'test_model3'; | ||
} | ||
|
||
/** | ||
* Allows to query a set of records that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return TestModel3[]|TestModel3|\Phalcon\Mvc\Model\ResultSetInterface | ||
*/ | ||
public static function find($parameters = null) | ||
{ | ||
return parent::find($parameters); | ||
} | ||
|
||
/** | ||
* Allows to query the first record that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return TestModel3|\Phalcon\Mvc\Model\ResultInterface | ||
*/ | ||
public static function findFirst($parameters = null) | ||
{ | ||
return parent::findFirst($parameters); | ||
} | ||
|
||
} |
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,63 @@ | ||
<?php | ||
|
||
class Testmodel4 extends \Phalcon\Mvc\Model | ||
{ | ||
|
||
/** | ||
* | ||
* @var integer | ||
* @Primary | ||
* @Identity | ||
* @Column(type="integer", length=10, nullable=false) | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* | ||
* @var string | ||
* @Column(type="string", length=45, nullable=false) | ||
*/ | ||
public $name; | ||
|
||
/** | ||
* Initialize method for model. | ||
*/ | ||
public function initialize() | ||
{ | ||
$this->setSchema("devtools"); | ||
$this->setSource("Testmodel4"); | ||
} | ||
|
||
/** | ||
* Returns table name mapped in the model. | ||
* | ||
* @return string | ||
*/ | ||
public function getSource() | ||
{ | ||
return 'Testmodel4'; | ||
} | ||
|
||
/** | ||
* Allows to query a set of records that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return Testmodel4[]|Testmodel4|\Phalcon\Mvc\Model\ResultSetInterface | ||
*/ | ||
public static function find($parameters = null) | ||
{ | ||
return parent::find($parameters); | ||
} | ||
|
||
/** | ||
* Allows to query the first record that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return Testmodel4|\Phalcon\Mvc\Model\ResultInterface | ||
*/ | ||
public static function findFirst($parameters = null) | ||
{ | ||
return parent::findFirst($parameters); | ||
} | ||
|
||
} |
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,35 @@ | ||
<?php | ||
|
||
/** | ||
* @var Codeception\Scenario $scenario | ||
*/ | ||
|
||
$I = new ConsoleTester($scenario); | ||
|
||
$I->wantToTest('Generating models'); | ||
$I->amInPath(dirname(app_path())); | ||
mkdir(tests_path('_data/console/app/models/all_model_test'), 0777, true); | ||
|
||
$I->runShellCommand('phalcon all-models --config=app/mysql/config.php --output=app/models/all_model_test'); | ||
|
||
$I->seeFileFound(app_path('models/all_model_test/TestModel.php')); | ||
$I->seeFileFound(app_path('models/all_model_test/TestModel2.php')); | ||
$I->seeFileFound(app_path('models/all_model_test/TestModel3.php')); | ||
$I->seeFileFound(app_path('models/all_model_test/Testmodel4.php')); | ||
|
||
$file1 = file_get_contents(app_path('models/files/TestModel.php')); | ||
$file2 = file_get_contents(app_path('models/files/TestModel2.php')); | ||
$file3 = file_get_contents(app_path('models/files/TestModel3.php')); | ||
$file4 = file_get_contents(app_path('models/files/Testmodel4.php')); | ||
|
||
$I->openFile(app_path('models/all_model_test/TestModel.php')); | ||
$I->seeFileContentsEqual($file1); | ||
|
||
$I->openFile(app_path('models/all_model_test/TestModel2.php')); | ||
$I->seeFileContentsEqual($file2); | ||
|
||
$I->openFile(app_path('models/all_model_test/TestModel3.php')); | ||
$I->seeFileContentsEqual($file3); | ||
|
||
$I->openFile(app_path('models/all_model_test/Testmodel4.php')); | ||
$I->seeFileContentsEqual($file4); |
Oops, something went wrong.