Skip to content

Commit

Permalink
Merge pull request #615 from vonglasow/fix-void
Browse files Browse the repository at this point in the history
Replace void by blank
  • Loading branch information
jubianchi committed Oct 8, 2016
2 parents a1485d6 + 8bc8187 commit 82ce0c5
Show file tree
Hide file tree
Showing 15 changed files with 73 additions and 36 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,5 +1,6 @@
# `dev-master`

* [#615](https://github.com/atoum/atoum/pull/615) Remove reserved keyword, replace void by blank ([@vonglasow])
* [#643](https://github.com/atoum/atoum/pull/643) atoum now requires PHP `>=5.6.0` ([@jubianchi])
* [#634](https://github.com/atoum/atoum/pull/634) Only one extension of a kind can be loaded. Extensions can be unloaded ([@agallou], [@jubianchi])
* [#619](https://github.com/atoum/atoum/pull/619) Add branches and paths coverage support to AtoumTask for Phing ([@oxman])
Expand Down
7 changes: 6 additions & 1 deletion classes/autoloader.php
Expand Up @@ -41,7 +41,12 @@ public function __construct(array $namespaces = array(), array $namespaceAliases
$this->addNamespaceAlias($alias, $target);
}

foreach ($classAliases ?: array('atoum' => __NAMESPACE__ . '\test', __NAMESPACE__ => __NAMESPACE__ . '\test') as $alias => $target)
$defaultAliases = array(
'atoum' => __NAMESPACE__ . '\test',
__NAMESPACE__ => __NAMESPACE__ . '\test'
);

foreach ($classAliases ?: $defaultAliases as $alias => $target)
{
$this->addClassAlias($alias, $target);
}
Expand Down
Expand Up @@ -8,7 +8,7 @@
mageekguy\atoum\observable
;

abstract class void extends report\field
abstract class blank extends report\field
{
protected $runner = null;

Expand Down
@@ -1,6 +1,6 @@
<?php

namespace mageekguy\atoum\report\fields\runner\tests\void;
namespace mageekguy\atoum\report\fields\runner\tests\blank;

use
mageekguy\atoum,
Expand All @@ -9,7 +9,7 @@
mageekguy\atoum\cli\colorizer
;

class cli extends report\fields\runner\tests\void
class cli extends report\fields\runner\tests\blank
{
protected $titlePrompt = null;
protected $titleColorizer = null;
Expand Down
2 changes: 1 addition & 1 deletion classes/reports/asynchronous/vim.php
Expand Up @@ -95,7 +95,7 @@ public function __construct()

$this->addField($uncompletedField);

$voidField = new runner\tests\void\cli();
$voidField = new runner\tests\blank\cli();
$voidField
->setTitlePrompt($firstLevelPrompt)
->setMethodPrompt($secondLevelPrompt)
Expand Down
2 changes: 1 addition & 1 deletion classes/reports/realtime/cli.php
Expand Up @@ -174,7 +174,7 @@ public function __construct()
$voidTestMethodPrompt = clone $secondLevelPrompt;
$voidTestMethodPrompt->setColorizer($voidTestColorizer);

$runnerVoidField = new runner\tests\void\cli();
$runnerVoidField = new runner\tests\blank\cli();
$runnerVoidField
->setTitlePrompt($firstLevelPrompt)
->setTitleColorizer($voidTestColorizer)
Expand Down
2 changes: 1 addition & 1 deletion classes/reports/realtime/cli/light.php
Expand Up @@ -109,7 +109,7 @@ public function __construct()
$voidTestOutputPrompt = clone $thirdLevelPrompt;
$voidTestOutputPrompt->setColorizer($voidTestColorizer);

$voidTestField = new runner\tests\void\cli();
$voidTestField = new runner\tests\blank\cli();
$voidTestField
->setTitlePrompt($firstLevelPrompt)
->setTitleColorizer($voidTestColorizer)
Expand Down
2 changes: 1 addition & 1 deletion classes/reports/realtime/nyancat.php
Expand Up @@ -158,7 +158,7 @@ public function __construct()
$voidTestMethodPrompt = clone $secondLevelPrompt;
$voidTestMethodPrompt->setColorizer($voidTestColorizer);

$runnerVoidField = new runner\tests\void\cli();
$runnerVoidField = new runner\tests\blank\cli();
$runnerVoidField
->setTitlePrompt($firstLevelPrompt)
->setTitleColorizer($voidTestColorizer)
Expand Down
2 changes: 1 addition & 1 deletion classes/reports/realtime/phing.php
Expand Up @@ -307,7 +307,7 @@ protected function build()

$this->addField($runnerUncompletedField);

$runnerVoidField = new runner\tests\void\cli();
$runnerVoidField = new runner\tests\blank\cli();
$runnerVoidField
->setTitlePrompt($firstLevelPrompt)
->setTitleColorizer($voidTestColorizer)
Expand Down
2 changes: 1 addition & 1 deletion classes/reports/realtime/santa.php
Expand Up @@ -158,7 +158,7 @@ public function __construct()
$voidTestMethodPrompt = clone $secondLevelPrompt;
$voidTestMethodPrompt->setColorizer($voidTestColorizer);

$runnerVoidField = new runner\tests\void\cli();
$runnerVoidField = new runner\tests\blank\cli();
$runnerVoidField
->setTitlePrompt($firstLevelPrompt)
->setTitleColorizer($voidTestColorizer)
Expand Down
73 changes: 52 additions & 21 deletions tests/units/classes/autoloader.php
Expand Up @@ -19,27 +19,6 @@ public function testClassConstants()
;
}

public function test__construct()
{
$this
->if($autoloader = new testedClass())
->then
->array($autoloader->getClasses())->isEmpty()
->variable($autoloader->getCacheFileForInstance())->isEqualTo(testedClass::getCacheFile())
->array($autoloader->getDirectories())->isEqualTo(array(
'mageekguy\atoum\\' => array(
array(
atoum\directory . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR,
testedClass::defaultFileSuffix
)
)
)
)
->array($autoloader->getNamespaceAliases())->isEqualTo(array('atoum\\' => 'mageekguy\\atoum\\'))
->array($autoloader->getClassAliases())->isEqualTo(array('atoum' => 'mageekguy\\atoum\\test', 'mageekguy\\atoum' => 'mageekguy\\atoum\\test'))
;
}

public function testAddNamespaceAlias()
{
$this
Expand Down Expand Up @@ -84,6 +63,58 @@ public function testAddNamespaceAlias()
;
}

/**
* @php >= 7.1
*/
public function testAddClassAliasphp71()
{
$this
->if($autoloader = new testedClass())
->then
->object($autoloader->addClassAlias($alias = uniqid(), $target = uniqid()))->isIdenticalTo($autoloader)
->array($autoloader->getClassAliases())->isEqualTo(array(
'atoum' => 'mageekguy\\atoum\\test',
'mageekguy\\atoum' => 'mageekguy\\atoum\\test',
$alias => $target
)
)
->object($autoloader->addClassAlias($alias, $target))->isIdenticalTo($autoloader)
->array($autoloader->getClassAliases())->isEqualTo(array(
'atoum' => 'mageekguy\\atoum\\test',
'mageekguy\\atoum' => 'mageekguy\\atoum\\test',
$alias => $target
)
)
->object($autoloader->addClassAlias('\\' . ($otherAlias = uniqid()), '\\' . ($otherTarget = uniqid())))->isIdenticalTo($autoloader)
->array($autoloader->getClassAliases())->isEqualTo(array(
'atoum' => 'mageekguy\\atoum\\test',
'mageekguy\\atoum' => 'mageekguy\\atoum\\test',
$alias => $target,
$otherAlias => $otherTarget
)
)
->object($autoloader->addClassAlias('\\' . ($anOtherAlias = uniqid()) . '\\', '\\' . ($anOtherTarget = uniqid()) . '\\'))->isIdenticalTo($autoloader)
->array($autoloader->getClassAliases())->isEqualTo(array(
'atoum' => 'mageekguy\\atoum\\test',
'mageekguy\\atoum' => 'mageekguy\\atoum\\test',
$alias => $target,
$otherAlias => $otherTarget,
$anOtherAlias => $anOtherTarget
)
)
->object($autoloader->addClassAlias('FOO', '\\' . ($fooTarget = uniqid()) . '\\'))->isIdenticalTo($autoloader)
->array($autoloader->getClassAliases())->isEqualTo(array(
'atoum' => 'mageekguy\\atoum\\test',
'mageekguy\\atoum' => 'mageekguy\\atoum\\test',
$alias => $target,
$otherAlias => $otherTarget,
$anOtherAlias => $anOtherTarget,
'foo' => $fooTarget
)
)
;
}

public function testAddClassAlias()
{
$this
Expand Down
Expand Up @@ -5,12 +5,12 @@
use
mageekguy\atoum,
mageekguy\atoum\runner,
mock\mageekguy\atoum\report\fields\runner\tests\void as testedClass
mock\mageekguy\atoum\report\fields\runner\tests\blank as testedClass
;

require __DIR__ . '/../../../../../runner.php';

class void extends atoum\test
class blank extends atoum\test
{
public function testClass()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/units/classes/reports/realtime/cli.php
Expand Up @@ -103,7 +103,7 @@ public function test__construct()
->setMethodPrompt(new prompt('=> ', new colorizer('0;37')))
->setOutputPrompt(new prompt('==> ', new colorizer('0;37')))
)
->define($runnerVoidField = new fields\runner\tests\void\cli())
->define($runnerVoidField = new fields\runner\tests\blank\cli())
->and($runnerVoidField
->setTitlePrompt(new prompt('> '))
->setTitleColorizer(new colorizer('0;34'))
Expand Down
2 changes: 1 addition & 1 deletion tests/units/classes/reports/realtime/cli/light.php
Expand Up @@ -61,7 +61,7 @@ public function test__construct()
->setMethodPrompt(new prompt('=> ', new colorizer('0;37')))
->setOutputPrompt(new prompt('==> ', new colorizer('0;37')))
)
->define($voidTestField = new fields\runner\tests\void\cli())
->define($voidTestField = new fields\runner\tests\blank\cli())
->define($voidTestField
->setTitlePrompt(new prompt('> '))
->setTitleColorizer(new colorizer('0;34'))
Expand Down
2 changes: 1 addition & 1 deletion tests/units/classes/reports/realtime/phing.php
Expand Up @@ -87,7 +87,7 @@ public function test__construct()
->setMethodPrompt(new prompt(' ', new colorizer('0;37')))
->setOutputPrompt(new prompt(' ', new colorizer('0;37')))
)
->define($runnerVoidField = new fields\runner\tests\void\cli())
->define($runnerVoidField = new fields\runner\tests\blank\cli())
->and($runnerVoidField
->setTitlePrompt(new prompt(PHP_EOL))
->setTitleColorizer(new colorizer('0;34'))
Expand Down

0 comments on commit 82ce0c5

Please sign in to comment.