Skip to content

Commit

Permalink
Merge pull request #620 from highstrike/patch-1
Browse files Browse the repository at this point in the history
Update Application.php
  • Loading branch information
markstory authored Jul 10, 2018
2 parents a947873 + 8dd3d32 commit 3fd8ce3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
namespace App;

use Cake\Core\Configure;
use Cake\Core\Exception\MissingPluginException;
use Cake\Error\Middleware\ErrorHandlerMiddleware;
use Cake\Http\BaseApplication;
use Cake\Http\Middleware\CsrfProtectionMiddleware;
Expand Down
38 changes: 38 additions & 0 deletions tests/TestCase/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,51 @@
use Cake\Routing\Middleware\AssetMiddleware;
use Cake\Routing\Middleware\RoutingMiddleware;
use Cake\TestSuite\IntegrationTestCase;
use InvalidArgumentException;

/**
* ApplicationTest class
*/
class ApplicationTest extends IntegrationTestCase
{

/**
* testBootstrap
*
* @return void
*/
public function testBootstrap()
{
$app = new Application(dirname(dirname(__DIR__)) . '/config');
$app->bootstrap();
$plugins = $app->getPlugins();

$this->assertCount(3, $plugins);
$this->assertSame('Bake', $plugins->get('Bake')->getName());
$this->assertSame('Migrations', $plugins->get('Migrations')->getName());
$this->assertSame('DebugKit', $plugins->get('DebugKit')->getName());
}

/**
* testBootstrapPluginWitoutHalt
*
* @return void
*/
public function testBootstrapPluginWitoutHalt()
{
$this->expectException(InvalidArgumentException::class);

$app = $this->getMockBuilder(Application::class)
->setConstructorArgs([dirname(dirname(__DIR__)) . '/config'])
->setMethods(['addPlugin'])
->getMock();

$app->method('addPlugin')
->will($this->throwException(new InvalidArgumentException('test exception.')));

$app->bootstrap();
}

/**
* testMiddleware
*
Expand Down

0 comments on commit 3fd8ce3

Please sign in to comment.