-
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.
- Loading branch information
zjin002c
committed
Jul 4, 2018
0 parents
commit b3e5cf2
Showing
246 changed files
with
27,817 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Compiled source # | ||
################### | ||
*.com | ||
*.class | ||
*.dll | ||
*.exe | ||
*.o | ||
*.so | ||
|
||
# Packages # | ||
############ | ||
# it's better to unpack these files and commit the raw source | ||
# git has its own built in compression methods | ||
*.7z | ||
*.dmg | ||
*.gz | ||
*.iso | ||
*.jar | ||
*.rar | ||
*.tar | ||
*.zip | ||
|
||
# Logs and databases # | ||
###################### | ||
*.log | ||
*.sql | ||
*.sqlite | ||
|
||
# OS generated files # | ||
###################### | ||
.DS_Store | ||
.DS_Store? | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
# temp files from editors | ||
*~ | ||
*.bak | ||
.DS_Store | ||
.buildpath | ||
.project | ||
.settings | ||
*.tmproj | ||
build | ||
.idea | ||
nbproject/ | ||
phpinfo.php | ||
|
||
# hidden files created by Windows | ||
Thumbs.db | ||
desktop.ini | ||
|
||
# the composer package lock file and install directory | ||
/composer.lock | ||
/fuel/vendor | ||
|
||
# any of the fuel packages installed by default | ||
/docs/ | ||
/fuel/core/ | ||
/fuel/packages/auth/ | ||
/fuel/packages/email/ | ||
/fuel/packages/oil/ | ||
/fuel/packages/orm/ | ||
/fuel/packages/parser/ | ||
|
||
# dynamically generated files | ||
/fuel/app/logs/*/*/* | ||
/fuel/app/cache/*/* | ||
/fuel/app/config/crypt.php | ||
/code_coverage/* | ||
/code-coverage/* | ||
|
||
# environment controls | ||
#*.htaccess | ||
|
||
### remove db config files | ||
/fuel/app/config/db.php | ||
/fuel/app/config/development/* | ||
/fuel/app/config/production/* | ||
/fuel/app/config/staging/* | ||
/fuel/app/config/test/* | ||
/fuel/core/classes/database/* | ||
|
||
|
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,12 @@ | ||
language: php | ||
php: | ||
- 5.3 | ||
- 5.4 | ||
- 5.5 | ||
- 7.0 | ||
|
||
before_script: | ||
- curl -s http://getcomposer.org/installer | php | ||
- php composer.phar install --dev | ||
|
||
script: php oil test |
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,3 @@ | ||
Please read the project contibuting guidelines before creating an issue of sending in a pull request: | ||
|
||
https://github.com/fuel/fuel/wiki/Contributing |
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 @@ | ||
|
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,132 @@ | ||
# Testing FuelPHP | ||
|
||
FuelPHP uses [PHPUnit](https://github.com/sebastianbergmann/phpunit/) for it's Unit Testing needs. It must be installed for the tests to run. | ||
|
||
**NOTE: No code will be accepted without tests written.** | ||
|
||
## Running Tests | ||
|
||
Running the unit tests is as simple as navigating to the root install folder on the command line and running the following: | ||
|
||
$ php oil test | ||
|
||
That's it! You can also tell it specific groups (which we will get into in minute) to run. For example to run only the core tests: | ||
|
||
$ php oil test --group=Core | ||
|
||
As you can see we've wrapped the phpunit command with our own Oil utility which will in time become more and more useful. If you wish to get right at the phpunit tests manually you can point it to our .xml configuration file: | ||
|
||
$ phpunit -c fuel/core/phpunit.xml --group Core | ||
|
||
This may break or change in future versions so it's suggested you stick with using Oil for your testing. | ||
|
||
## Writing Tests | ||
|
||
### Where do they go? | ||
|
||
All tests are to go in the **tests** folders inside their respective parent folder. For instance: | ||
|
||
* App tests go in *fuel/app/tests* | ||
* Core tests go in *fuel/core/tests* | ||
* Package tests go in *fuel/packages/package_name/tests* | ||
|
||
### File / Class Naming | ||
|
||
The Test class names should be in the form of **Tests_Whatever**. | ||
|
||
Filenames should be all lower case and be the class name minus the "Tests_" part. | ||
|
||
Some example names: | ||
|
||
// Good | ||
Tests_Arr in fuel/core/tests/arr.php | ||
Tests_Image in fuel/core/tests/image.php | ||
Tests_Fuel in fuel/core/tests/fuel.php | ||
|
||
// Bad | ||
Arrtests | ||
Somestuff | ||
|
||
### Test Grouping | ||
|
||
All tests inside the **core** folder must be in the **core** group. A classes test's should also be grouped together under the name of the class. | ||
|
||
Here is an example of a core class test with proper DocBlocks: | ||
|
||
/** | ||
* Arr class tests | ||
* | ||
* @group Core | ||
* @group Arr | ||
*/ | ||
class Tests_Arr extends TestCase { | ||
|
||
/** | ||
* Tests Arr::get() | ||
* | ||
* @test | ||
*/ | ||
public function test_get() | ||
{ | ||
// Test code here | ||
} | ||
} | ||
|
||
All App tests should be in the **app** group. | ||
|
||
### Namespaces | ||
|
||
All **core** tests should be in the **Fuel\Core** namespace. This is so that we are sure we are testing the core classes, | ||
not any extensions that may be in *app*. | ||
|
||
App tests can be in any namespace. | ||
|
||
### What class do I extend? | ||
|
||
All tests should extend the **Fuel\Core\TestCase** class. | ||
|
||
**NOTE: if you are in the Fuel\Core namespace you can leave off the Fuel\Core namespace and just extend **TestCase**. | ||
|
||
## Example | ||
|
||
namespace Fuel\Core; | ||
|
||
/** | ||
* Arr class tests | ||
* | ||
* @group Core | ||
* @group Arr | ||
*/ | ||
class Tests_Arr extends TestCase { | ||
|
||
/** | ||
* Tests Arr::flatten_assoc() | ||
* | ||
* @test | ||
*/ | ||
public function test_flatten_assoc() | ||
{ | ||
$people = array( | ||
array( | ||
"name" => "Jack", | ||
"age" => 21 | ||
), | ||
array( | ||
"name" => "Jill", | ||
"age" => 23 | ||
) | ||
); | ||
|
||
$expected = array( | ||
"0:name" => "Jack", | ||
"0:age" => 21, | ||
"1:name" => "Jill", | ||
"1:age" => 23 | ||
); | ||
|
||
$output = Arr::flatten_assoc($people); | ||
$this->assertEquals($expected, $output); | ||
} | ||
|
||
} | ||
|
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,49 @@ | ||
{ | ||
"name": "fuel/fuel", | ||
"type": "project", | ||
"description" : "FuelPHP is a simple, flexible, community driven PHP 5.3.3+ framework, based on the best ideas of other frameworks, with a fresh start!", | ||
"keywords": ["application", "website", "development", "framework", "PHP", "PHP7"], | ||
"license": "MIT", | ||
"require": { | ||
"php": ">=5.3.3", | ||
"composer/installers": "~1.0", | ||
"fuel/core": "1.8.*", | ||
"fuel/auth": "1.8.*", | ||
"fuel/email": "1.8.*", | ||
"fuel/oil": "1.8.*", | ||
"fuel/orm": "1.8.*", | ||
"fuel/parser": "1.8.*", | ||
"fuelphp/upload": "2.0.6", | ||
"monolog/monolog": "1.5.*", | ||
"phpseclib/phpseclib": "2.0.0", | ||
"michelf/php-markdown": "1.4.0", | ||
"phpunit/phpunit": "5.7.*", | ||
"squizlabs/php_codesniffer": "2.*" | ||
}, | ||
"require-dev": { | ||
"fuel/docs": "1.8.*" | ||
}, | ||
"suggest": { | ||
"dwoo/dwoo" : "Allow Dwoo templating with the Parser package", | ||
"mustache/mustache": "Allow Mustache templating with the Parser package", | ||
"smarty/smarty": "Allow Smarty templating with the Parser package", | ||
"twig/twig": "Allow Twig templating with the Parser package", | ||
"pyrocms/lex": "Allow Lex templating with the Parser package", | ||
"mthaml/mthaml": "Allow Haml templating with Twig supports with the Parser package" | ||
}, | ||
"config": { | ||
"vendor-dir": "fuel/vendor" | ||
}, | ||
"extra": { | ||
"installer-paths": { | ||
"fuel/{$name}": ["fuel/core"], | ||
"{$name}": ["fuel/docs"] | ||
} | ||
}, | ||
"scripts": { | ||
"post-install-cmd": [ | ||
"php oil r install" | ||
] | ||
}, | ||
"minimum-stability": "stable" | ||
} |
Binary file not shown.
Oops, something went wrong.