APEX 19.2 : Command line utility APEXExport throws error - oracle-apex

I am trying to export my application using the command line utility APEXExport. (APEX 19.2)
Exception in thread "main" java.sql.SQLException: ORA-06550: line 2, column 12:
PLS-00306: wrong number or types of arguments in call to 'GET_APPLICATION'
ORA-06550: line 2, column 5:
PL/SQL: Statement ignored
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:494)
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:446)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1054)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:623)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:252)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:612)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:223)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:56)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:907)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1119)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3780)
at oracle.jdbc.driver.T4CCallableStatement.executeInternal(T4CCallableStatement.java:1300)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3887)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4230)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1079)
at oracle.apex.APEXExport.exec_and_write_files(APEXExport.java:222)
at oracle.apex.APEXExport.ExportFile(APEXExport.java:523)
at oracle.apex.APEXExport.ExportFiles(APEXExport.java:332)
at oracle.apex.APEXExport.main(APEXExport.java:890)
Caused by: Error : 6550, Position : 17, Sql = begin
:1 := apex_export.get_application (
p_application_id => :2 ,
p_split => :3 ='Y',
p_with_date => :4 ='Y',
p_with_ir_public_reports => :5 ='Y',
p_with_ir_private_reports => :6 ='Y',
p_with_ir_notifications => :7 ='Y',
p_with_translations => :8 ='Y',
p_with_pkg_app_mapping => :9 ='Y',
p_with_original_ids => :10 ='Y',
p_with_no_subscriptions => :11 ='Y',
p_with_comments => :12 ='Y',
p_with_supporting_objects => :13 ,
p_with_acl_assignments => :14 ='Y',
p_components => apex_string.split(:15 ,'#') );
end;, OriginalSql = begin
? := apex_export.get_application (
p_application_id => ?,
p_split => ?='Y',
p_with_date => ?='Y',
p_with_ir_public_reports => ?='Y',
p_with_ir_private_reports => ?='Y',
p_with_ir_notifications => ?='Y',
p_with_translations => ?='Y',
p_with_pkg_app_mapping => ?='Y',
p_with_original_ids => ?='Y',
p_with_no_subscriptions => ?='Y',
p_with_comments => ?='Y',
p_with_supporting_objects => ?,
p_with_acl_assignments => ?='Y',
p_components => apex_string.split(?,'#') );
end;, Error Msg = ORA-06550: line 2, column 12:
PLS-00306: wrong number or types of arguments in call to 'GET_APPLICATION'
ORA-06550: line 2, column 5:
PL/SQL: Statement ignored
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:498)
... 18 more
I ran a fairly staright forward command from cmd
cd <Navigated to utilites folder in apex installation>
%JAVA_HOME%\java oracle.apex.APEXExport -db "myhost:myport:servicename" -user my_user -password my_password -applicationid 120
However, when i use APEX 18.2 installation, application is exported without issues.
Let me know if i am doing it wrong? Or is it a bug in APEX 19.2 (not listed in know issues)
Thanks in advance

Nowadays I would recommend using SQLcl instead of the "old" APEXExport utility...
SQLcl has built in APEX export tools which work nicely and have all the features of the old utility plus some more. Just connect with SQLcl to your DB parsing schema and type "apex export" for a command help page.
https://www.oracle.com/database/technologies/appdev/sqlcl.html
apex export command

Related

AWS PHP 7 Session got reset in every reset in

I am very new with AWS while deploying my project i found that session is not getting stored .
so with help of google and stack-overflow i was trying to resolve is and trying following code
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
ini_set('display_errors', 'on');
//ini_set('session.gc_maxlifetime', 1500);
ini_set("session.save_handler", "files");
$dir=getcwd() . '/ses'; //folder with 777 permission
ini_set('session.save_path', $dir);
//ini_set('session.name', "name-session");
ini_set('session.gc_probability', 1);
ini_set('session.use_only_cookies', 0);
//ini_set('session.serialize_handler', '');
$sId = session_id();if ($sId == '') { session_start(); }
print_r($_SESSION);
$_SESSION['loggedIn']="swarna";
$_SESSION['name']=session_name();
$_SESSION['cookie_params']=session_get_cookie_params();
$_SESSION['cache_expire']=session_cache_expire();
$_SESSION['session_id']=session_id();
$_SESSION['maxlifetime']=ini_get("session.gc_maxlifetime");
echo "<br> \n <pre>";
print_r($_SESSION);
print_r(scandir($dir));
echo "<br> \n </pre>";
but it didn't worked each time i refresh it is printing the first print_r($_SESSION); as empty and second one with different session id while expedition first one with same data which i have stored last execution .
Array ( )
Array
(
[loggedIn] => swarna
[name] => name-session
[cookie_params] => Array
(
[lifetime] => 0
[path] => /
[domain] =>
[secure] =>
[httponly] =>
)
[cache_expire] => 180
[session_id] => qip9hisbsh901gbpbjef4qe70c
[maxlifetime] => 1440
)
Array
(
[0] => .
[1] => ..
[2] => sess_2rkl7v7h593ih942i1k14o9s4d
[3] => sess_4ccmmm0efq7quj26pm6r0ue9sn
[4] => sess_8rvh2nd9n0ng4vtekevh6p26ef
[5] => sess_lj4r99u9gf22ur935jr4gbcd97
[6] => sess_qip9hisbsh901gbpbjef4qe70c
)
now i am using php7 in AWS Amazon Linux 2 server . can any one guide me what to be done ? what is wrong their .
i have also tried
this has nothing to do with AWS or ec2, I recommend you comment out all PHP into variables at the beginning of the script and always have session_start() at the beginning script

Adding single quotes into a sed command and also in a ssh command

I'm in trouble doing a sed command inside an ssh call. I need to use single quotes in my sed command. Here is my command line :
ssh root#192.168.0.32 "sed -i '/0 => '192.168.0.32' /a 1 => '$old',' /tmp/test"
Here is the file :
<?php
$CONFIG = array (
'trusted_domains' =>
array (
0 => '192.168.0.32',
),
'dbtype' => 'mysql',
'dbport' => '',
'dbtableprefix' => 'oc_',
'logtimezone' => 'UTC',
'installed' => true,
'redis' =>
array (
'host' => '192.168.0.13',
'port' => 9095,
),
'mail_smtpmode' => 'sendmail',
'mail_from_address' => 'noreply',
'knowledgebaseenabled' => false,
0 => 18,
'loglevel' => 1,
'maintenance' => false,
);
In this context, I want to add in the trusted_domains for example 1 => '192.168.0.1', after the first element.
The problem of the command is that he doesn't recognize the single quotes inside the sed command.
Don't forget, the sed command is inside a ssh command
Let's minimize this problem (and in the process of it realize, that most of your context could be stripped from your question.) First we define a helper function args to understand how the commands are split into words
$ args() { for x in "$#"; do echo "[$x]"; done; }
$ old=0.0.0.0
$ args ssh root#192.168.0.32 "sed -i '/0 => '192.168.0.32' /a 1 => '$old',' /tmp/test"
[ssh]
[root#192.168.0.32]
[sed -i '/0 => '192.168.0.32' /a 1 => '0.0.0.0',' /tmp/test]
Therefore a single argument ("sed -i ...") is passed to ssh. The double
quotes are necessary for the variable expansion to take place but we can
simplify the problem by inlining the old variable:
$ args sed -i '/0 => '192.168.0.32' /a 1 => '0.0.0.0',' /tmp/test
[sed]
[-i]
[/0 => 192.168.0.32 /a 1 => 0.0.0.0,]
[/tmp/test]
We can simplify this further
$ args '/0 => '192.168.0.32' /a 1 => '0.0.0.0','
[/0 => 192.168.0.32 /a 1 => 0.0.0.0,]
and replacing the complicated argument with a much simpler one
$ args 'foo'1'bar'
[foo1bar]
Notice that the three strings 'foo', 1 and bar are concatenated to the
single world foo1bar. And now you can ask a simpler question:
How can I add a single quote to the string 'foo'1'bar'? And the answer is:
$ args 'foo'\'1\''bar'
[foo'1'bar]
Note though that "foo'1'bar" does not work in your case since you already used the double quotes for the outer ssh command.
Could you try the following command (replace the username, hostname accordingly to your needs):
ssh toto#localhost "sed '/0 => \x27192.168.0.32\x27/a 1 => \x27$old\x27,' /tmp/test"
output:
<?php
$CONFIG = array (
'trusted_domains' =>
array (
0 => '192.168.0.32',
1 => '1.1.1.1',
),
'dbtype' => 'mysql',
'dbport' => '',
'dbtableprefix' => 'oc_',
'logtimezone' => 'UTC',
'installed' => true,
'redis' =>
array (
'host' => '192.168.0.13',
'port' => 9095,
),
'mail_smtpmode' => 'sendmail',
'mail_from_address' => 'noreply',
'knowledgebaseenabled' => false,
0 => 18,
'loglevel' => 1,
'maintenance' => false,
);
If this works, just add -i options if you are really sure about what you are doing. you can also do the -i.bak to force sed to take a back up of your files

Uncaught exception 'Predis\Response\ServerException' with message 'MOVED 7369

Getting this error :
[error] 1118#1118: *366 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught exception 'Predis\Response\ServerException' with message 'MOVED 7369 10.0.213.16:6379'
My Redis connection code is:
$parameters = array(
"scheme" => "tcp",
"host" => "testingredis.akf46e.clustercfg.use1.cache.amazonaws.com",
"port" => 6379,
"database" => 0,
);
$db = new Predis\Client($parameters, $options);
Note: The above code is working fine in local but not working in my AWS server. Any help would be appreciated.
After lots of research successfully completed the redis cluster with the AWS elasticache.
$options = array('cluster' => 'redis');
$parameters = array(
'clusters' => array(
'default' => array(
'scheme' => 'tcp',
'host' => HOST_URL,
'port' => 6379,
'database' => 0
),
),
);
$db = new Predis\Client($parameters,$options);
Were struggling with same. this is short version of what works:
$redis = new Predis\Client(
['tcp://127.0.0.1:6379'],
['cluster' => 'redis']
);

AWS php sdk is not working with PHP 7

Following code works well in PHP 5.6.
require_once '../aws/aws-autoloader.php';
$config = [
'region' => 'ap-south-1',
'version' => 'latest',
'credentials' => [
'key' => '...',
'secret' => '...'
]
];
$sdk = new Aws\Sdk($config);
$client = $sdk->createS3();
But on PHP 7, it through error:
Fatal error: Uncaught TypeError: Argument 1 passed to Aws\Common\Client\AbstractClient::__construct() must be an instance of Aws\Common\Credentials\CredentialsInterface, array given, called in /var/www/html/webservice/vendor/aws3/Aws/Sdk.php on line 316 and defined in /var/www/html/aws-sdk/vendor/aws/aws-sdk-php/src/Aws/Common/Client/AbstractClient.php:75 Stack trace: #0 /var/www/html/webservice/vendor/aws3/Aws/Sdk.php(316): Aws\Common\Client\AbstractClient->__construct(Array) #1 /var/www/html/webservice/vendor/aws3/Aws/Sdk.php(291): Aws\Sdk->createClient('S3', Array) #2 index.php(14): Aws\Sdk->__call('createS3', Array) thrown in /var/www/html/aws-sdk/vendor/aws/aws-sdk-php/src/Aws/Common/Client/AbstractClient.php on line 75
Please suggest me how can I make it work on PHP 7.
Thanks.
UPDATE: I have both AWS SDK version 2 & 3 in my project. this might be a issue of conflict. Then how to solve the conflict?
This problem doesn't have any issue with PHP 7.0.
It's the case of conflict SDK ver 2 & 3.
This two sdk can't be used together. so I had to upgrade to sdk 3.

How can I test Eloquent in Workbench?

EDITS: 1
I need to test an Eloquent model by touching the database and I Have this test case:
use Mockery as m;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Database\Connectors\ConnectionFactory;
use Illuminate\Database\DatabaseManager;
use Illuminate\Database\ConnectionResolver;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Artisan;
use Illuminate\Container\Container;
use Illuminate\Config\Repository as Config;
use Illuminate\Database\Console\Migrations\MigrateCommand;
use Illuminate\Database\Migrations\Migrator;
use Illuminate\Database\Migrations\DatabaseMigrationRepository;
use Illuminate\Filesystem\Filesystem;
class Module extends Eloquent {
protected $table = 'modules';
protected $fillable = array('name');
}
class UserTest extends PHPUnit_Framework_TestCase{
public function setUp()
{
$this->modelName = 'My Model Name';
$this->migrationsTable = 'migrations';
$this->environment = 'testing';
$this->connectionName = 'postgresql'; // postgresql memory
date_default_timezone_set('UTC');
$this->app = new Application;
$this->migrationPath = __DIR__ . '/../../migrations';
$this->app->instance('path', __DIR__);
$this->app->instance('config', $config = new Config(
$this->app->getConfigLoader(), $this->environment
));
$this->app['config']['app'] = array( 'debug' => true,
'url' => 'http://localhost',
'timezone' => 'UTC',
'locale' => 'en',
'key' => 'YourSecretKey!!!',
'providers' => array(
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
'Illuminate\Cache\CacheServiceProvider',
'Illuminate\Session\CommandsServiceProvider',
'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
'Illuminate\Routing\ControllerServiceProvider',
'Illuminate\Cookie\CookieServiceProvider',
'Illuminate\Database\DatabaseServiceProvider',
'Illuminate\Encryption\EncryptionServiceProvider',
'Illuminate\Filesystem\FilesystemServiceProvider',
'Illuminate\Hashing\HashServiceProvider',
'Illuminate\Html\HtmlServiceProvider',
'Illuminate\Log\LogServiceProvider',
'Illuminate\Mail\MailServiceProvider',
'Illuminate\Database\MigrationServiceProvider',
'Illuminate\Pagination\PaginationServiceProvider',
'Illuminate\Queue\QueueServiceProvider',
'Illuminate\Redis\RedisServiceProvider',
'Illuminate\Remote\RemoteServiceProvider',
'Illuminate\Auth\Reminders\ReminderServiceProvider',
'Illuminate\Database\SeedServiceProvider',
'Illuminate\Session\SessionServiceProvider',
'Illuminate\Translation\TranslationServiceProvider',
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',
'Illuminate\Workbench\WorkbenchServiceProvider',
),
'manifest' => '/meta',
'aliases' => array(
'App' => 'Illuminate\Support\Facades\App',
'Artisan' => 'Illuminate\Support\Facades\Artisan',
'Auth' => 'Illuminate\Support\Facades\Auth',
'Blade' => 'Illuminate\Support\Facades\Blade',
'Cache' => 'Illuminate\Support\Facades\Cache',
'ClassLoader' => 'Illuminate\Support\ClassLoader',
'Config' => 'Illuminate\Support\Facades\Config',
'Controller' => 'Illuminate\Routing\Controller',
'Cookie' => 'Illuminate\Support\Facades\Cookie',
'Crypt' => 'Illuminate\Support\Facades\Crypt',
'DB' => 'Illuminate\Support\Facades\DB',
'Eloquent' => 'Illuminate\Database\Eloquent\Model',
'Event' => 'Illuminate\Support\Facades\Event',
'File' => 'Illuminate\Support\Facades\File',
'Form' => 'Illuminate\Support\Facades\Form',
'Hash' => 'Illuminate\Support\Facades\Hash',
'HTML' => 'Illuminate\Support\Facades\HTML',
'Input' => 'Illuminate\Support\Facades\Input',
'Lang' => 'Illuminate\Support\Facades\Lang',
'Log' => 'Illuminate\Support\Facades\Log',
'Mail' => 'Illuminate\Support\Facades\Mail',
'Paginator' => 'Illuminate\Support\Facades\Paginator',
'Password' => 'Illuminate\Support\Facades\Password',
'Queue' => 'Illuminate\Support\Facades\Queue',
'Redirect' => 'Illuminate\Support\Facades\Redirect',
'Redis' => 'Illuminate\Support\Facades\Redis',
'Request' => 'Illuminate\Support\Facades\Request',
'Response' => 'Illuminate\Support\Facades\Response',
'Route' => 'Illuminate\Support\Facades\Route',
'Schema' => 'Illuminate\Support\Facades\Schema',
'Seeder' => 'Illuminate\Database\Seeder',
'Session' => 'Illuminate\Support\Facades\Session',
'SSH' => 'Illuminate\Support\Facades\SSH',
'Str' => 'Illuminate\Support\Str',
'URL' => 'Illuminate\Support\Facades\URL',
'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View',
),
);
$this->app['config']['database'] = array('connections' => array(
'memory' => array(
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => ''
),
'postgresql' => array(
'driver' => 'pgsql',
'host' => 'localhost',
'database' => 'antoniocarlosribeiro',
'username' => 'antoniocarlos',
'password' => 'basswort',
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
),
)
);
$this->factory = new ConnectionFactory($this->app);
$this->manager = new DatabaseManager($this->app, $this->factory);
$this->migrateCommand = new MigrateCommand(
new Migrator(
new DatabaseMigrationRepository(
$this->manager,
$this->migrationsTable
),
$this->manager,
new Filesystem
),
$this->migrationPath
);
$this->model = new Module;
$this->model->setConnectionResolver($this->manager);
$this->model->setConnection($this->connectionName);
// $this->app->instance('artisan', $artisan = new Artisan($this->app));
// $this->app['artisan']->add($this->migrateCommand);
// $this->app['artisan']->call('migrate:refresh');
}
public function tearDown()
{
m::close();
}
public function testCreated()
{
$this->assertInstanceOf('Illuminate\Database\Eloquent\Model', $this->model);
}
public function testDeleteCreateSelect()
{
$this->model->on($this->connectionName)->where('name', $this->modelName)->delete();
$this->model->on($this->connectionName)->insert( array('name' => $this->modelName, 'created_at' => new DateTime, 'updated_at' => new DateTime) );
$this->assertEquals($this->model->where('name', $this->modelName)->first()->name, $this->modelName);
}
}
This thing is working fine. Delete, insert and select are working and hitting the database, so I get a green.
I plan to develop the tests on database, to take a look at the data and then move to :memory:, for speed.
The problem now is that I need Artisan to be working, so I can migrate:refresh on every run, but if I enable those 3 artisan lines it goes down to a recursive call to artisan:
PHP 1. {main}() /usr/share/phpunit/vendor/phpunit/phpunit/composer/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/share/phpunit/vendor/phpunit/phpunit/composer/bin/phpunit:63
PHP 3. PHPUnit_TextUI_Command->run() /usr/share/phpunit/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:129
PHP 4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/phpunit/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176
PHP 5. PHPUnit_Framework_TestSuite->run() /usr/share/phpunit/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:349
PHP 6. PHPUnit_Framework_TestSuite->run() /usr/share/phpunit/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:705
PHP 7. PHPUnit_Framework_TestSuite->runTest() /usr/share/phpunit/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:745
PHP 8. PHPUnit_Framework_TestCase->run() /usr/share/phpunit/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:775
PHP 9. PHPUnit_Framework_TestResult->run() /usr/share/phpunit/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:783
PHP 10. PHPUnit_Framework_TestCase->runBare() /usr/share/phpunit/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648
PHP 11. UserTest->setUp() /usr/share/phpunit/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:835
PHP 12. Illuminate\Foundation\Artisan->add() /dev.app/workbench/antonio/package/tests/Package/UserTest.php:174
PHP 13. Illuminate\Foundation\Artisan->__call() /dev.app/workbench/antonio/package/tests/Package/UserTest.php:174
PHP 14. call_user_func_array() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:82
PHP 15. Illuminate\Foundation\Artisan->add() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:82
PHP 16. Illuminate\Foundation\Artisan->__call() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:0
PHP 17. call_user_func_array() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:82
PHP 18. Illuminate\Foundation\Artisan->add() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:82
PHP 19. Illuminate\Foundation\Artisan->__call() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:0
PHP 20. call_user_func_array() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:82
PHP 21. Illuminate\Foundation\Artisan->add() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:82
PHP 22. Illuminate\Foundation\Artisan->__call() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:0
PHP 23. call_user_func_array() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:82
PHP 24. Illuminate\Foundation\Artisan->add() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:82
PHP 25. Illuminate\Foundation\Artisan->__call() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:0
PHP 26. call_user_func_array() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:82
PHP 27. Illuminate\Foundation\Artisan->add() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:82
PHP 28. Illuminate\Foundation\Artisan->__call() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:0
PHP 29. call_user_func_array() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:82
PHP 30. Illuminate\Foundation\Artisan->add() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:82
PHP 31. Illuminate\Foundation\Artisan->__call() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:0
PHP 32. call_user_func_array() /dev.app/workbench/antonio/package/vendor/laravel/framework/src/Illuminate/Foundation/Artisan.php:82
Any leads on instantiating and using Artisan correctly?
Mocking a connection
Mocking a database connection gets complicated (I've done it before, it's messy!).
This is some code I had working in a unit test after a ton of trial and error some months ago:
Illuminate\Database\Eloquent\Model::setConnectionResolver($resolver = m::mock('Illuminate\Database\ConnectionResolverInterface'));
$resolver->shouldReceive('connection')->andReturn($mockConnection = m::mock('Illuminate\Database\ConnectionInterface'));
$mockConnection->shouldreceive('getPostProcessor')->andReturn(m::mock('Illuminate\Database\Query\Processors\Processor'));
$mockConnection->shouldReceive('getQueryGrammar')->andReturn($queryGrammar = m::mock('Illuminate\Database\Query\Grammars\Grammar'));
$queryGrammar->shouldReceive('getDateFormat')->andReturn('Y-m-d H:i:s');
Using sqllite
I will suggest, then, to actually use a sqlite database for testing database connections. I've found this much easier.
Testing with PHPunit triggers the testing environment in Laravel, so you can define an in-memory (only on for that request) sqlite database connection on that environment and and even seed it in your test setup.
Here's a sample gist for testing using an in-memory sqlite database.
Testing things already tested
Your unit test here might be simplistic for example, I'm not sure - However, you're testing something that's already tested in Laravel. Consider carefully what you decide to test :D