Skip to content
This repository was archived by the owner on Nov 19, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ matrix:

# PHP5.6
- php: 5.6
env: PHALCON_VERSION="3.2.x" SLAYER_VERSION="dev-dev"
env: PHALCON_VERSION="3.2.x" SLAYER_VERSION="dev"
- php: 5.6
env: PHALCON_VERSION="3.1.x" SLAYER_VERSION="dev-dev"
env: PHALCON_VERSION="3.1.x" SLAYER_VERSION="dev"
- php: 5.6
env: PHALCON_VERSION="3.0.x" SLAYER_VERSION="dev-dev"
env: PHALCON_VERSION="3.0.x" SLAYER_VERSION="dev"

# PHP7.0
- php: 7.0
env: PHALCON_VERSION="3.2.x" SLAYER_VERSION="dev-dev"
env: PHALCON_VERSION="3.2.x" SLAYER_VERSION="dev"
- php: 7.0
env: PHALCON_VERSION="3.1.x" SLAYER_VERSION="dev-dev"
env: PHALCON_VERSION="3.1.x" SLAYER_VERSION="dev"
- php: 7.0
env: PHALCON_VERSION="3.0.x" SLAYER_VERSION="dev-dev"
env: PHALCON_VERSION="3.0.x" SLAYER_VERSION="dev"

# PHP7.1
# - php: 7.1
# env: PHALCON_VERSION="3.2.x" SLAYER_VERSION="dev-dev"
# env: PHALCON_VERSION="3.2.x" SLAYER_VERSION="dev"
# - php: 7.1
# env: PHALCON_VERSION="3.1.x" SLAYER_VERSION="dev-dev"
# env: PHALCON_VERSION="3.1.x" SLAYER_VERSION="dev"
# - php: 7.1
# env: PHALCON_VERSION="3.0.x" SLAYER_VERSION="dev-dev"
# env: PHALCON_VERSION="3.0.x" SLAYER_VERSION="dev"

env:
global:
Expand Down
34 changes: 27 additions & 7 deletions build/ci/build.sh
Original file line number Diff line number Diff line change
@@ -1,43 +1,63 @@
#!/usr/bin/env bash

# clone slayer
composer create-project phalconslayer/slayer:${SLAYER_VERSION} ~/${SLAYER_FOLDER}
git clone -b ${SLAYER_VERSION} --depth 1 https://github.com/phalconslayer/slayer.git ~/${SLAYER_FOLDER}

cd ~/${SLAYER_FOLDER}

rm composer.lock

# update composer and slayer's vendor

#-------------------------------------------------------------------------------


# check php info
php -m

# check composer updates
composer self-update

# require framework based on version
composer require phalconslayer/framework:dev-${TRAVIS_BRANCH}
composer require techpivot/phalcon-ci-installer:~1.0

# install dependencies
composer update


#-------------------------------------------------------------------------------


# copy .env.travis as .env file
cp vendor/phalconslayer/framework/tests/.env.travis .env
mkdir config/travis
cat .env


# require framework based on version
composer require phalconslayer/framework:dev-${TRAVIS_BRANCH}
composer require techpivot/phalcon-ci-installer:~1.0
#-------------------------------------------------------------------------------


# execute phalcon ci installer
vendor/bin/install-phalcon.sh ${PHALCON_VERSION}


#-------------------------------------------------------------------------------


# create 'slayer' database
mysql -e 'create database slayer charset=utf8mb4 collate=utf8mb4_unicode_ci;'


# db migrations
php brood db:migrate


#-------------------------------------------------------------------------------


# built-in web
php -S ${SERVE_HOST}:${SERVE_PORT} -t public/ > internal-server.log 2>&1 &
sleep 5


cd ..

#-------------------------------------------------------------------------------
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,21 @@
"guzzlehttp/guzzle": "6.1.*",
"illuminate/support": "5.4.*",
"jenssegers/blade": "^1.0",
"paragonie/random_compat": "1.1.*",
"paragonie/random_compat": "~1.4|~2.0",
"league/flysystem": "^1.0",
"league/tactician": "^0.6",
"mailgun/mailgun-php": "2.2.*",
"mailgun/mailgun-php": "~1.7|~2.2",
"monolog/monolog": "^1.15",
"robmorgan/phinx": "0.6.*",
"robmorgan/phinx": "0.5.*",
"swiftmailer/swiftmailer": "^5.4",
"symfony/console": "^2.7",
"symfony/debug": "^2.7",
"symfony/debug": "~3.2",
"symfony/process": "^2.7",
"symfony/var-dumper": "^2.7",
"tijsverkoyen/css-to-inline-styles": "^1.5",
"vlucas/phpdotenv": "^2.0",
"psy/psysh": "0.7.*"
"psy/psysh": "0.7.*",
"php-http/guzzle6-adapter": "1.1.*"
},
"replace": {
"clarity/console": "self.version",
Expand Down
4 changes: 2 additions & 2 deletions src/Clarity/Console/App/ControllerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ protected function getControllerName($is_path = true)

return sprintf(
$ret,
di()->get('dispatcher')->getControllerSuffix(),
studly_case(
str_slug($this->input->getArgument('name'), '_')
)
),
di()->get('dispatcher')->getControllerSuffix()
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Clarity/Console/App/stubs/controller/controller.stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace {namespace};

class {controllerName}Controller extends Controller
class {controllerName} extends Controller
{
{controllerFunctions}
}
4 changes: 2 additions & 2 deletions src/Clarity/Providers/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

namespace Clarity\Providers;

use Phalcon\Events\Manager as PhalconEventsManager;
use Phalcon\Mvc\Dispatcher as PhalconMvcDispatcher;
use Clarity\Exceptions\ControllerNotFoundException;
use Clarity\Support\Phalcon\Events\Manager as PhalconEventsManager;
use Clarity\Support\Phalcon\Mvc\Dispatcher as PhalconMvcDispatcher;
use Phalcon\Mvc\Dispatcher\Exception as DispatchException;

/**
Expand Down
20 changes: 20 additions & 0 deletions src/Clarity/Support/Phalcon/Events/Manager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/**
* PhalconSlayer\Framework.
*
* @copyright 2015-2016 Daison Carino <daison12006013@gmail.com>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://docs.phalconslayer.com
*/

namespace Clarity\Support\Phalcon\Events;

use Phalcon\Events\Manager as BaseManager;

/**
* {@inheritdoc}
*/
class Manger extends BaseManager
{
}
29 changes: 29 additions & 0 deletions src/Clarity/Support/Phalcon/Mvc/Dispatcher.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/**
* PhalconSlayer\Framework.
*
* @copyright 2015-2016 Daison Carino <daison12006013@gmail.com>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://docs.phalconslayer.com
*/

namespace Clarity\Support\Phalcon\Mvc;

use Phalcon\Mvc\Dispatcher as BaseDispatcher;

/**
* {@inheritdoc}
*/
class Dispatcher extends BaseDispatcher
{
/**
* Get controller suffix.
*
* @return string
*/
public function getControllerSuffix()
{
return $this->_handlerSuffix;
}
}
6 changes: 3 additions & 3 deletions src/Clarity/Support/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
}
],
"require": {
"illuminate/support": "5.2.*",
"illuminate/support": "5.4.*",
"fzaninotto/faker": "~1.4",
"league/tactician": "^0.6",
"paragonie/random_compat": "1.1.*",
"paragonie/random_compat": "~1.4|~2.0",
"clarity/contracts": "1.4.*",
"clarity/exceptions": "1.4.*",
"robmorgan/phinx": "0.5.*"
"robmorgan/phinx": "0.6.*"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 4 additions & 2 deletions tests/clarity/Console/AppTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ public function testAppRoute()
'php brood app:controller test test_module',
]);

$has_file = file_exists($file = config()->path->app.'TestModule/Controllers/TestController.php');
$controller_name = 'Test'.di()->get('dispatcher')->getControllerSuffix();

$has_file = file_exists($file = config()->path->app.'TestModule/Controllers/'.$controller_name.'.php');
$this->assertTrue($has_file, 'check if ['.$file.'] were generated');

$file_contents = file_get_contents($file);
$this->assertContains('namespace App\\TestModule\\Controllers;', $file_contents);
$this->assertContains('class TestController extends Controller', $file_contents);
$this->assertContains('class '.$controller_name.' extends Controller', $file_contents);
}
}