Skip to content

Commit

Permalink
Added namespaces to some test fixtures.
Browse files Browse the repository at this point in the history
  • Loading branch information
SidRoberts authored and niden committed Jun 9, 2019
1 parent 907bc0d commit e0d3655
Show file tree
Hide file tree
Showing 18 changed files with 156 additions and 130 deletions.
11 changes: 7 additions & 4 deletions tests/_data/fixtures/Di/services.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<?php

use Phalcon\Config;
use Phalcon\Test\Module\UnitTest;

return [
'unit-test' => [
'className' => \Phalcon\Test\Module\UnitTest::class,
'className' => UnitTest::class,
],
'config' => [
'className' => \Phalcon\Config::class,
'shared' => true,
'className' => Config::class,
'shared' => true,
],
'component' => [
'className' => \SomeComponent::class,
'className' => SomeComponent::class,
'arguments' => [
[
'type' => 'service',
Expand Down
2 changes: 2 additions & 0 deletions tests/_data/fixtures/Events/ComponentX.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* file that was distributed with this source code.
*/

namespace Phalcon\Test\Fixtures\Events;

use Phalcon\Events\Manager;

class ComponentX
Expand Down
2 changes: 2 additions & 0 deletions tests/_data/fixtures/Events/ComponentY.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* file that was distributed with this source code.
*/

namespace Phalcon\Test\Fixtures\Events;

use Phalcon\Events\Manager;

class ComponentY
Expand Down
7 changes: 1 addition & 6 deletions tests/_data/fixtures/Listener/ThirdListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

namespace Phalcon\Test\Fixtures\Listener;

use ComponentX;
use function dataDir;
use Phalcon\Events\Event;
use Phalcon\Test\Fixtures\Events\ComponentX;
use Phalcon\Test\Unit\Events\ManagerCest;
use UnitTester;

Expand All @@ -30,11 +30,6 @@ class ThirdListener

protected $after = 0;

public function __construct()
{
include_once dataDir('fixtures/Events/ComponentX.php');
}

public function setTestCase(ManagerCest $testCase, UnitTester $tester)
{
$this->testCase = $testCase;
Expand Down
2 changes: 2 additions & 0 deletions tests/_data/fixtures/tasks/ParamsTask.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Phalcon\Test\Fixtures\Tasks;

class ParamsTask extends \Phalcon\CLI\Task
{
public function paramsAction()
Expand Down
6 changes: 1 addition & 5 deletions tests/cli/Cli/Dispatcher/GetParamCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ class GetParamCest

public function _before(CliTester $I)
{
/**
* @todo Check the loader
*/
require_once dataDir('fixtures/tasks/ParamsTask.php');

$this->setNewCliFactoryDefault();
}

Expand All @@ -43,6 +38,7 @@ public function testCliParameters(CliTester $I)
);

// Test $this->dispatcher->getParam()
$dispatcher->setNamespaceName('Phalcon\Test\Fixtures\Tasks');
$dispatcher->setTaskName('params');
$dispatcher->setActionName('param');

Expand Down
6 changes: 1 addition & 5 deletions tests/cli/Cli/Dispatcher/GetParamsCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ class GetParamsCest

public function _before(CliTester $I)
{
/**
* @todo Check the loader
*/
require_once dataDir('fixtures/tasks/ParamsTask.php');

$this->setNewCliFactoryDefault();
}

Expand All @@ -41,6 +36,7 @@ public function testCliParameters(CliTester $I)
);

// Test $this->dispatcher->getParams()
$dispatcher->setNamespaceName('Phalcon\Test\Fixtures\Tasks');
$dispatcher->setTaskName('params');
$dispatcher->setActionName('params');

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/Mvc/Model/GetRelatedCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function mvcModelGetRelated(IntegrationTester $I)
$robotParts = $robot->getRelated('robotsParts');

$I->assertInstanceOf(
'Phalcon\Mvc\Model\Resultset\Simple',
\Phalcon\Mvc\Model\Resultset\Simple::class,
$robotParts
);

Expand Down
52 changes: 26 additions & 26 deletions tests/integration/Mvc/Model/Refactor-BinderCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ public function testDispatcherSingleBinding(IntegrationTester $I)
]
);

$I->assertInstanceOf('Phalcon\Test\Models\People', $returnedValue);
$I->assertInstanceOf(People::class, $returnedValue);

$I->assertEquals($this->people->cedula, $returnedValue->cedula);

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'people' => People::class,
],
$this->cache->get('_PHMB_Test10Controller_viewAction')
);
Expand Down Expand Up @@ -219,8 +219,8 @@ public function testDispatcherMultiBinding(IntegrationTester $I)

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'robots' => 'Phalcon\\Test\\Models\\Robots',
'people' => People::class,
'robots' => Robots::class,
],
$this->cache->get('_PHMB_Test10Controller_multipleAction')
);
Expand Down Expand Up @@ -257,7 +257,7 @@ public function testDispatcherSingleBindingWithInterface(IntegrationTester $I)

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'people' => People::class,
],
$this->cache->get('_PHMB_Test11Controller_viewAction')
);
Expand Down Expand Up @@ -301,8 +301,8 @@ public function testDispatcherMultiBindingWithInterface(IntegrationTester $I)

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'robots' => 'Phalcon\\Test\\Models\\Robots',
'people' => People::class,
'robots' => Robots::class,
],
$this->cache->get('_PHMB_Test11Controller_multipleAction')
);
Expand Down Expand Up @@ -355,7 +355,7 @@ function () use ($dispatcher) {

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'people' => People::class,
],
$this->cache->get('_PHMB_Test9Controller_viewAction')
);
Expand Down Expand Up @@ -395,7 +395,7 @@ function (People $people) {

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'people' => People::class,
],
$this->cache->get('_PHMB_people')
);
Expand Down Expand Up @@ -455,8 +455,8 @@ function (People $people, Robots $robot) {

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'robots' => 'Phalcon\\Test\\Models\\Robots',
'people' => People::class,
'robots' => Robots::class,
],
$this->cache->get('_PHMB_/{people}/robot/{robots}')
);
Expand Down Expand Up @@ -508,7 +508,7 @@ function () use ($micro) {

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'people' => People::class,
],
$this->cache->get('_PHMB_/{people}')
);
Expand Down Expand Up @@ -550,7 +550,7 @@ public function testMicroControllerSingleBinding(IntegrationTester $I)

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'people' => People::class,
],
$this->cache->get('_PHMB_Test10Controller_viewAction')
);
Expand Down Expand Up @@ -598,8 +598,8 @@ public function testMicroControllerMultiBinding(IntegrationTester $I)

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'robots' => 'Phalcon\\Test\\Models\\Robots',
'people' => People::class,
'robots' => Robots::class,
],
$this->cache->get('_PHMB_Test10Controller_multipleAction')
);
Expand Down Expand Up @@ -639,7 +639,7 @@ public function testMicroControllerSingleBindingWithInterface(IntegrationTester

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'people' => People::class,
],
$this->cache->get('_PHMB_Test11Controller_viewAction')
);
Expand Down Expand Up @@ -687,8 +687,8 @@ public function testMicroControllerMultiBindingWithInterface(IntegrationTester $

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'robots' => 'Phalcon\\Test\\Models\\Robots',
'people' => People::class,
'robots' => Robots::class,
],
$this->cache->get('_PHMB_Test11Controller_multipleAction')
);
Expand Down Expand Up @@ -742,7 +742,7 @@ function () use ($micro) {

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'people' => People::class,
],
$this->cache->get('_PHMB_Test9Controller_viewAction')
);
Expand Down Expand Up @@ -783,7 +783,7 @@ public function testMicroLazySingleBinding(IntegrationTester $I)

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'people' => People::class,
],
$this->cache->get('_PHMB_Test10Controller_viewAction')
);
Expand Down Expand Up @@ -832,8 +832,8 @@ public function testMicroLazyMultiBinding(IntegrationTester $I)

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'robots' => 'Phalcon\\Test\\Models\\Robots',
'people' => People::class,
'robots' => Robots::class,
],
$this->cache->get('_PHMB_Test10Controller_multipleAction')
);
Expand Down Expand Up @@ -874,7 +874,7 @@ public function testMicroLazySingleBindingWithInterface(IntegrationTester $I)

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'people' => People::class,
],
$this->cache->get('_PHMB_Test11Controller_viewAction')
);
Expand Down Expand Up @@ -923,8 +923,8 @@ public function testMicroLazyMultiBindingWithInterface(IntegrationTester $I)

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'robots' => 'Phalcon\\Test\\Models\\Robots',
'people' => People::class,
'robots' => Robots::class,
],
$this->cache->get('_PHMB_Test11Controller_multipleAction')
);
Expand Down Expand Up @@ -979,7 +979,7 @@ function () use ($micro) {

$I->assertEquals(
[
'people' => 'Phalcon\\Test\\Models\\People',
'people' => People::class,
],
$this->cache->get('_PHMB_Test9Controller_viewAction')
);
Expand Down
Loading

0 comments on commit e0d3655

Please sign in to comment.