Skip to content

Commit 995e337

Browse files
author
Younès El Biache
committed
fix tests for previous commit
1 parent 2acbaaf commit 995e337

File tree

12 files changed

+39
-38
lines changed

12 files changed

+39
-38
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ php:
55
- 5.4
66
- 5.5
77
- 5.6
8+
- 7.0
89
- hhvm-nightly
910

1011
matrix:

tests/Ladybug/Tests/Model/VariableWrapperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class VariableWrapperTest extends \PHPUnit_Framework_TestCase
1010

1111
public function testObjectCreation()
1212
{
13-
$var = new \Ladybug\Type\Int();
13+
$var = new \Ladybug\Type\IntType();
1414
$var->load(1);
1515

1616
$variableWrapper = new VariableWrapper(1, $var, VariableWrapper::TYPE_CLASS);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
use Ladybug\Type;
66

7-
class BoolTest extends \PHPUnit_Framework_TestCase
7+
class BoolTypeTest extends \PHPUnit_Framework_TestCase
88
{
99

1010
/** @var Type\Bool $type */
1111
protected $type;
1212

1313
public function setUp()
1414
{
15-
$this->type = new Type\Bool();
15+
$this->type = new Type\BoolType();
1616
}
1717

1818
public function testLoaderForValidValues()

tests/Ladybug/Tests/Type/FactoryTypeTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function setUp()
1616
/*$maxlevel = 8;
1717
1818
$factoryTypeMock = m::mock('Ladybug\Type\FactoryType');
19-
$factoryTypeMock->shouldReceive('factory')->with(m::anyOf(1, 2, 3), m::any())->andReturn(new Type\Int());
19+
$factoryTypeMock->shouldReceive('factory')->with(m::anyOf(1, 2, 3), m::any())->andReturn(new Type\IntType());
2020
*/
2121

2222
$managerInspectorMock = m::mock('Ladybug\Inspector\InspectorManager');
@@ -26,14 +26,14 @@ public function setUp()
2626
$metadataResolverMock->shouldReceive('has')->andReturn(false);
2727

2828
$this->factory = new Type\FactoryType();
29-
$this->factory->add(new Type\Int(), 'type_int');
30-
$this->factory->add(new Type\Bool(), 'type_bool');
31-
$this->factory->add(new Type\Null(), 'type_null');
32-
$this->factory->add(new Type\Float(), 'type_float');
33-
$this->factory->add(new Type\String(), 'type_string');
29+
$this->factory->add(new Type\IntType(), 'type_int');
30+
$this->factory->add(new Type\BoolType(), 'type_bool');
31+
$this->factory->add(new Type\NullType(), 'type_null');
32+
$this->factory->add(new Type\FloatType(), 'type_float');
33+
$this->factory->add(new Type\StringType(), 'type_string');
3434
$this->factory->add(new Type\Vector\Container(8, $this->factory), 'type_array');
3535
$this->factory->add(new Type\Object\Container(8, $this->factory, $managerInspectorMock, $metadataResolverMock), 'type_object');
36-
$this->factory->add(new Type\Resource($this->factory, $managerInspectorMock, $metadataResolverMock), 'type_resource');
36+
$this->factory->add(new Type\ResourceType($this->factory, $managerInspectorMock, $metadataResolverMock), 'type_resource');
3737
}
3838

3939
public function tearDown()
@@ -45,35 +45,35 @@ public function testFactoryForIntValues()
4545
{
4646
$var = 1;
4747
$type = $this->factory->factory($var);
48-
$this->assertEquals('Ladybug\\Type\\Int', get_class($type));
48+
$this->assertEquals('Ladybug\\Type\\IntType', get_class($type));
4949
}
5050

5151
public function testFactoryForBoolValues()
5252
{
5353
$var = true;
5454
$type = $this->factory->factory($var);
55-
$this->assertEquals('Ladybug\\Type\\Bool', get_class($type));
55+
$this->assertEquals('Ladybug\\Type\\BoolType', get_class($type));
5656
}
5757

5858
public function testFactoryForFloatValues()
5959
{
6060
$var = 1.2;
6161
$type = $this->factory->factory($var);
62-
$this->assertEquals('Ladybug\\Type\\Float', get_class($type));
62+
$this->assertEquals('Ladybug\\Type\\FloatType', get_class($type));
6363
}
6464

6565
public function testFactoryForNullValues()
6666
{
6767
$var = null;
6868
$type = $this->factory->factory($var);
69-
$this->assertEquals('Ladybug\\Type\\Null', get_class($type));
69+
$this->assertEquals('Ladybug\\Type\\NullType', get_class($type));
7070
}
7171

7272
public function testFactoryForStringValues()
7373
{
7474
$var = 'test';
7575
$type = $this->factory->factory($var);
76-
$this->assertEquals('Ladybug\\Type\\String', get_class($type));
76+
$this->assertEquals('Ladybug\\Type\\StringType', get_class($type));
7777
}
7878

7979
public function testFactoryForArrayValues()
@@ -94,15 +94,15 @@ public function testFactoryForResourceValues()
9494
{
9595
$var = fopen(__DIR__ . '/../../../files/test.txt', 'rb');
9696
$type = $this->factory->factory($var);
97-
$this->assertInstanceOf('Ladybug\\Type\\Resource', $type);
97+
$this->assertInstanceOf('Ladybug\\Type\\ResourceType', $type);
9898
}
9999

100100
public function testFactoryForUnknownResourceValues()
101101
{
102102
$var = fopen(__DIR__ . '/../../../files/test.txt', 'rb');
103103
fclose($var); // Turns resource into type "Unknown"
104104
$type = $this->factory->factory($var);
105-
$this->assertInstanceOf('Ladybug\\Type\\Resource', $type);
105+
$this->assertInstanceOf('Ladybug\\Type\\ResourceType', $type);
106106
}
107107

108108
/*public function testLoaderForOtherType()

tests/Ladybug/Tests/Type/FloatTest.php renamed to tests/Ladybug/Tests/Type/FloatTypeTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
use Ladybug\Type;
66

7-
class FloatTest extends \PHPUnit_Framework_TestCase
7+
class FloatTypeTest extends \PHPUnit_Framework_TestCase
88
{
99

1010
/** @var Type\Float $type */
1111
protected $type;
1212

1313
public function setUp()
1414
{
15-
$this->type = new Type\Float();
15+
$this->type = new Type\FloatType();
1616
}
1717

1818
public function testLoaderForValidValues()
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
use Ladybug\Type;
66

7-
class IntTest extends \PHPUnit_Framework_TestCase
7+
class IntTypeTest extends \PHPUnit_Framework_TestCase
88
{
99

1010
/** @var Type\Int $type */
1111
protected $type;
1212

1313
public function setUp()
1414
{
15-
$this->type = new Type\Int();
15+
$this->type = new Type\IntType();
1616
}
1717

1818
public function testLoaderForValidValues()
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
use Ladybug\Type;
66

7-
class NullTest extends \PHPUnit_Framework_TestCase
7+
class NullTypeTest extends \PHPUnit_Framework_TestCase
88
{
99

1010
/** @var Type\Null $type */
1111
protected $type;
1212

1313
public function setUp()
1414
{
15-
$this->type = new Type\Null();
15+
$this->type = new Type\NullType();
1616
}
1717

1818
public function testLoaderForValidValues()

tests/Ladybug/Tests/Type/Object/BadTypeHintedParameterContainerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class BadTypeHintedParameterContainerTest extends \PHPUnit_Framework_TestCase
1616
protected function setUp()
1717
{
1818
$factory = new Type\FactoryType();
19-
$factory->add(new Type\Null(), 'type_null');
19+
$factory->add(new Type\NullType(), 'type_null');
2020

2121
$managerInspectorMock = m::mock('Ladybug\Inspector\InspectorManager');
2222
$managerInspectorMock->shouldReceive('get')->andReturn(null);
@@ -53,7 +53,7 @@ public function testDumperDoesNotCrashOnWrongTypeHints()
5353
$badTypeHinted = $privateMethod->getParameterByName('baz');
5454
$this->assertEquals('[Undefined Type Hint]', $badTypeHinted->getType());
5555
$this->assertFalse($badTypeHinted->isReference());
56-
$this->assertInstanceOf('Ladybug\Type\Null', $badTypeHinted->getDefaultValue());
56+
$this->assertInstanceOf('Ladybug\Type\NullType', $badTypeHinted->getDefaultValue());
5757
}
5858
}
5959

tests/Ladybug/Tests/Type/Object/ContainerTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function setUp()
1717
$maxlevel = 8;
1818
$factoryTypeMock = m::mock('Ladybug\Type\FactoryType');
1919
$factoryTypeMock->shouldReceive('factory')->with(m::anyOf(1, 2, 3, 4), m::any())->andReturnUsing(function($var, $level) {
20-
$intType = new Type\Int();
20+
$intType = new Type\IntType();
2121
$intType->load($var, $level);
2222

2323
return $intType;
@@ -61,29 +61,29 @@ public function testLoaderForValidValues()
6161
$this->assertInstanceOf('Ladybug\Type\Object\Property', $privateProperty);
6262
$this->assertEquals('privateProperty', $privateProperty->getName());
6363
$this->assertEquals(VisibilityInterface::VISIBILITY_PRIVATE, $privateProperty->getVisibility());
64-
$this->assertInstanceOf('Ladybug\Type\Int', $privateProperty->getValue());
64+
$this->assertInstanceOf('Ladybug\Type\IntType', $privateProperty->getValue());
6565
$this->assertEquals(2, $privateProperty->getLevel());
6666
$this->assertEquals('Ladybug\Tests\Type\Object\Bar', $privateProperty->getOwner());
6767

6868
$this->assertInstanceOf('Ladybug\Type\Object\Property', $protectedProperty);
6969
$this->assertEquals('protectedProperty', $protectedProperty->getName());
7070
$this->assertEquals(VisibilityInterface::VISIBILITY_PROTECTED, $protectedProperty->getVisibility());
71-
$this->assertInstanceOf('Ladybug\Type\Int', $protectedProperty->getValue());
71+
$this->assertInstanceOf('Ladybug\Type\IntType', $protectedProperty->getValue());
7272
$this->assertEquals(2, $protectedProperty->getLevel());
7373
$this->assertEquals('Ladybug\Tests\Type\Object\Bar', $protectedProperty->getOwner());
7474

7575
$this->assertInstanceOf('Ladybug\Type\Object\Property', $publicProperty);
7676
$this->assertEquals('publicProperty', $publicProperty->getName());
7777
$this->assertEquals(VisibilityInterface::VISIBILITY_PUBLIC, $publicProperty->getVisibility());
78-
$this->assertInstanceOf('Ladybug\Type\Int', $publicProperty->getValue());
78+
$this->assertInstanceOf('Ladybug\Type\IntType', $publicProperty->getValue());
7979
$this->assertEquals(2, $publicProperty->getLevel());
8080
$this->assertEquals('Ladybug\Tests\Type\Object\Bar', $publicProperty->getOwner());
8181

8282
// constants
8383
$this->assertEquals(1, count($this->type->getClassConstants()));
8484
$constant = $this->type->getConstantByName('CONSTANT');
8585
$this->assertEquals('CONSTANT', $constant->getName());
86-
$this->assertInstanceOf('Ladybug\Type\Int', $constant->getValue());
86+
$this->assertInstanceOf('Ladybug\Type\IntType', $constant->getValue());
8787
$this->assertEquals(2, $constant->getLevel());
8888

8989
// methods
@@ -138,7 +138,7 @@ public function testLoaderForValidValues()
138138

139139
$this->assertEquals('p5', $parameter5->getName());
140140
$this->assertFalse($parameter5->isReference());
141-
$this->assertInstanceOf('Ladybug\Type\Int', $parameter5->getDefaultValue());
141+
$this->assertInstanceOf('Ladybug\Type\IntType', $parameter5->getDefaultValue());
142142
$this->assertNull($parameter5->getType());
143143

144144
// method info

tests/Ladybug/Tests/Type/ResourceTest.php renamed to tests/Ladybug/Tests/Type/ResourceTypeTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Ladybug\Type\ObjectType\VisibilityInterface;
77
use \Mockery as m;
88

9-
class ResourceTest extends \PHPUnit_Framework_TestCase
9+
class ResourceTypeTest extends \PHPUnit_Framework_TestCase
1010
{
1111

1212
/** @var Type\Resource $type */
@@ -15,15 +15,15 @@ class ResourceTest extends \PHPUnit_Framework_TestCase
1515
public function setUp()
1616
{
1717
$factoryTypeMock = m::mock('Ladybug\Type\FactoryType');
18-
$factoryTypeMock->shouldReceive('factory')->with(m::anyOf(1, 2, 3), m::any())->andReturn(new Type\Int());
18+
$factoryTypeMock->shouldReceive('factory')->with(m::anyOf(1, 2, 3), m::any())->andReturn(new Type\IntType());
1919

2020
$managerInspectorMock = m::mock('Ladybug\Inspector\InspectorManager');
2121
$managerInspectorMock->shouldReceive('get')->andReturn(null);
2222

2323
$metadataResolverMock = m::mock('Ladybug\Metadata\MetadataResolver');
2424
$metadataResolverMock->shouldReceive('has')->andReturn(false);
2525

26-
$this->type = new Type\Resource($factoryTypeMock, $managerInspectorMock, $metadataResolverMock);
26+
$this->type = new Type\ResourceType($factoryTypeMock, $managerInspectorMock, $metadataResolverMock);
2727
}
2828

2929
public function tearDown()

0 commit comments

Comments
 (0)