Skip to content

Commit

Permalink
Convert tests namespace.
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed Feb 12, 2017
1 parent 03cc27a commit cc2d3a2
Show file tree
Hide file tree
Showing 14 changed files with 127 additions and 62 deletions.
5 changes: 5 additions & 0 deletions composer.json
Expand Up @@ -16,6 +16,11 @@
"Orchestra\\Testbench\\" : "src/"
}
},
"autoload-dev": {
"psr-4": {
"Orchestra\\Testbench\\Tests\\" : "tests/"
}
},
"require": {
"php": ">=5.5.0",
"laravel/framework": "~5.1.27",
Expand Down
13 changes: 5 additions & 8 deletions tests/BehatFeatureContextTest.php
@@ -1,6 +1,8 @@
<?php namespace Orchestra\Testbench\TestCase;
<?php

use Orchestra\Testbench\BehatFeatureContext;
namespace Orchestra\Testbench\Tests;

use Orchestra\Testbench\Tests\Stubs\FeatureContext;

class BehatFeatureContextTest extends \PHPUnit_Framework_TestCase
{
Expand All @@ -11,7 +13,7 @@ class BehatFeatureContextTest extends \PHPUnit_Framework_TestCase
*/
public function testCreateApplicationMethod()
{
$stub = new StubFeatureContext([]);
$stub = new FeatureContext([]);
$app = $stub->createApplication();

$this->assertInstanceOf('\Orchestra\Testbench\TestCaseInterface', $stub);
Expand All @@ -21,8 +23,3 @@ public function testCreateApplicationMethod()
$this->assertInstanceOf('\Illuminate\Config\Repository', $app['config']);
}
}

class StubFeatureContext extends BehatFeatureContext
{
//
}
8 changes: 6 additions & 2 deletions tests/DatabaseFixtureTest.php
@@ -1,6 +1,10 @@
<?php namespace Orchestra\Testbench\TestCase;
<?php

class DatabaseFixtureTest extends \Orchestra\Testbench\TestCase
namespace Orchestra\Testbench\Tests;

use Orchestra\Testbench\TestCase;

class DatabaseFixtureTest extends TestCase
{
/**
* Setup the test environment.
Expand Down
8 changes: 6 additions & 2 deletions tests/DefaultConfigurationTest.php
@@ -1,6 +1,10 @@
<?php namespace Orchestra\Testbench\TestCase;
<?php

class DefaultConfigurationTest extends \Orchestra\Testbench\TestCase
namespace Orchestra\Testbench\Tests;

use Orchestra\Testbench\TestCase;

class DefaultConfigurationTest extends TestCase
{
/**
* `cache.default` value is set to array.
Expand Down
39 changes: 4 additions & 35 deletions tests/Integrations/AggregateServiceProviderTest.php
@@ -1,4 +1,6 @@
<?php namespace Orchestra\Testbench\Integrations\TestCase;
<?php

namespace Orchestra\Testbench\Tests\Integrations;

use Orchestra\Testbench\TestCase;
use Illuminate\Support\ServiceProvider;
Expand All @@ -16,7 +18,7 @@ class AggregateServiceProviderTest extends TestCase
protected function getPackageProviders($app)
{
return [
'Orchestra\Testbench\Integrations\TestCase\ParentService',
'Orchestra\Testbench\Tests\Stubs\ParentServiceProvider',
];
}

Expand All @@ -36,36 +38,3 @@ public function testServiceIsAvailable()
$this->assertTrue($this->app->make('child.deferred.loaded'));
}
}

class ParentService extends AggregateServiceProvider
{
protected $providers = [
'Orchestra\Testbench\Integrations\TestCase\ChildService',
'Orchestra\Testbench\Integrations\TestCase\DeferredChildService',
];

public function register()
{
parent::register();

$this->app['parent.loaded'] = true;
}
}

class ChildService extends ServiceProvider
{
public function register()
{
$this->app['child.loaded'] = true;
}
}

class DeferredChildService extends ServiceProvider
{
protected $defer = true;

public function register()
{
$this->app['child.deferred.loaded'] = true;
}
}
23 changes: 9 additions & 14 deletions tests/RouteTest.php
@@ -1,8 +1,11 @@
<?php namespace Orchestra\Testbench\TestCase;
<?php

namespace Orchestra\Testbench\Tests;

use Illuminate\Routing\Router;
use Orchestra\Testbench\TestCase;

class RouteTest extends \Orchestra\Testbench\TestCase
class RouteTest extends TestCase
{
/**
* Define environment setup.
Expand Down Expand Up @@ -31,7 +34,7 @@ protected function getEnvironmentSetUp($app)
})->name('boss.bye');
});

$app['router']->resource('foo', 'Orchestra\Testbench\TestCase\FooController');
$app['router']->resource('foo', 'Orchestra\Testbench\Tests\Stubs\Controller');
}

/**
Expand Down Expand Up @@ -105,10 +108,10 @@ public function testGetPrefixedRoutesViaNameRoute()
*/
public function testGetFooIndexRouteUsingAction()
{
$crawler = $this->action('GET', '\Orchestra\Testbench\TestCase\FooController@index');
$crawler = $this->action('GET', '\Orchestra\Testbench\Tests\Stubs\Controller@index');

$this->assertResponseOk();
$this->assertEquals('FooController@index', $crawler->getContent());
$this->assertEquals('Controller@index', $crawler->getContent());
}

/**
Expand All @@ -121,14 +124,6 @@ public function testGetFooIndexRouteUsingCall()
$crawler = $this->call('GET', 'foo');

$this->assertResponseOk();
$this->assertEquals('FooController@index', $crawler->getContent());
}
}

class FooController extends \Illuminate\Routing\Controller
{
public function index()
{
return 'FooController@index';
$this->assertEquals('Controller@index', $crawler->getContent());
}
}
11 changes: 11 additions & 0 deletions tests/Stubs/ChildServiceProvider.php
@@ -0,0 +1,11 @@
<?php

namespace Orchestra\Testbench\Tests\Stubs;

class ChildServiceProvider extends ServiceProvider
{
public function register()
{
$this->app['child.loaded'] = true;
}
}
11 changes: 11 additions & 0 deletions tests/Stubs/Controller.php
@@ -0,0 +1,11 @@
<?php

namespace Orchestra\Testbench\Tests\Stubs;

class Controller extends \Illuminate\Routing\Controller
{
public function index()
{
return 'Controller@index';
}
}
13 changes: 13 additions & 0 deletions tests/Stubs/DeferredChildServiceProvider.php
@@ -0,0 +1,13 @@
<?php

namespace Orchestra\Testbench\Tests\Stubs;

class DeferredChildServiceProvider extends ServiceProvider
{
protected $defer = true;

public function register()
{
$this->app['child.deferred.loaded'] = true;
}
}
10 changes: 10 additions & 0 deletions tests/Stubs/FeatureContext.php
@@ -0,0 +1,10 @@
<?php

namespace Orchestra\Testbench\Tests\Stubs;

use Orchestra\Testbench\BehatFeatureContext;

class FeatureContext extends BehatFeatureContext
{
//
}
20 changes: 20 additions & 0 deletions tests/Stubs/ParentServiceProvider.php
@@ -0,0 +1,20 @@
<?php

namespace Orchestra\Testbench\Tests\Stubs;

use Illuminate\Support\AggregateServiceProvider;

class ParentServiceProvider extends AggregateServiceProvider
{
protected $providers = [
ChildServiceProvider::class,
DeferredChildServiceProvider::class,
];

public function register()
{
parent::register();

$this->app['parent.loaded'] = true;
}
}
16 changes: 16 additions & 0 deletions tests/Stubs/ServiceProvider.php
@@ -0,0 +1,16 @@
<?php

namespace Orchestra\Testbench\Tests\Stubs;

class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
public function register()
{
//
}

public function boot()
{
//
}
}
8 changes: 8 additions & 0 deletions tests/Stubs/TestCase.php
@@ -0,0 +1,8 @@
<?php

namespace Orchestra\Testbench\Tests\Stubs;

class TestCase extends \Orchestra\Testbench\TestCase
{
//
}
4 changes: 3 additions & 1 deletion tests/TestCaseTest.php
@@ -1,4 +1,6 @@
<?php namespace Orchestra\Testbench\TestCase;
<?php

namespace Orchestra\Testbench\Tests;

class TestCaseTest extends \PHPUnit_Framework_TestCase
{
Expand Down

0 comments on commit cc2d3a2

Please sign in to comment.