Skip to content

Commit d3ceb92

Browse files
committed
fixes test
Signed-off-by: Faizan Akram <[email protected]>
1 parent 86f95c5 commit d3ceb92

5 files changed

+27
-26
lines changed

phpunit.xml.dist

+2-7
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,15 @@
2525
<log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/>
2626

2727
<log type="coverage-html"
28-
target="build/coverage"
29-
title="CodeGen"
30-
charset="UTF-8"
31-
yui="true"
32-
highlight="true"
28+
target="build/coverage"
3329
lowUpperBound="35"
3430
highLowerBound="70"/>
3531

3632
<log type="coverage-clover"
3733
target="build/logs/clover.xml"/>
3834

3935
<log type="junit"
40-
target="build/logs/junit.xml"
41-
logIncompleteSkipped="false"/>
36+
target="build/logs/junit.xml"/>
4237

4338
</logging>
4439

tests/ClassTemplate/ClassDeclareTest.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ClassFileTest extends CodeGenTestCase
88
public function testUse()
99
{
1010
$use = new UseClass('\Foo\Bar');
11-
is( 'Foo\Bar', $use->class );
11+
$this->assertCodeEquals('use Foo\Bar;', $use);
1212
}
1313

1414
public function testClassTemplateWithDefaultOptions()
@@ -36,27 +36,27 @@ public function testClassTemplate()
3636
'template' => 'Class.php.twig',
3737
'template_dirs' => array('src/ClassTemplate/Templates'),
3838
));
39-
ok($classTemplate);
39+
$this->assertTrue($classTemplate);
4040
$classTemplate->addProperty('record','Product');
4141
$classTemplate->addProperty('fields', array('lang', 'name'));
4242
$classTemplate->addMethod('public','getTwo',array(),'return 2;');
4343
$classTemplate->addMethod('public','getFoo',array('$i'),'return $i;');
4444

4545
$this->evalTemplate($classTemplate);
4646

47-
ok(class_exists($classTemplate->class->getFullName()));
47+
$this->assertTrue(class_exists($classTemplate->class->getFullName()));
4848

4949
$bar22 = new Foo\Bar1;
50-
ok($bar22);
50+
$this->assertTrue($bar22);
5151

52-
is('Product', $bar22->record);
53-
is(array('lang','name'), $bar22->fields);
52+
$this->assertEquals('Product', $bar22->record);
53+
$this->assertEquals(array('lang','name'), $bar22->fields);
5454

55-
ok(method_exists($bar22,'getTwo'));
56-
ok(method_exists($bar22,'getFoo'));
55+
$this->assertTrue(method_exists($bar22,'getTwo'));
56+
$this->assertTrue(method_exists($bar22,'getFoo'));
5757

58-
is(2,$bar22->getTwo());
58+
$this->assertEquals(2,$bar22->getTwo());
5959

60-
is(3,$bar22->getFoo(3));
60+
$this->assertEquals(3,$bar22->getFoo(3));
6161
}
6262
}

tests/ClassTemplate/ClassDeclareTraitTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public function testTraitUseAs() {
4949
$this->evalTemplate($classTemplate);
5050

5151
$foo = new Foo\TraitUseAsTest;
52-
ok($foo);
53-
is('hello from A',$foo->talk());
54-
is('hello from B',$foo->hello());
52+
$this->assertTrue($foo);
53+
$this->assertEquals('hello from A',$foo->talk());
54+
$this->assertEquals('hello from B',$foo->hello());
5555
}
5656
}
5757

tests/ClassTemplate/ClassInjectionTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ public function __toString() {
1919
);
2020
require 'tests/tmp_class';
2121
$foo = new InjectFoo;
22-
ok($foo);
22+
$this->assertTrue($foo);
2323

2424
$inject = new ClassTemplate\ClassInjection($foo);
25-
ok($inject);
25+
$this->assertTrue($inject);
2626

2727
$inject->read();
2828

@@ -37,20 +37,20 @@ function getValue() {
3737
$inject->write();
3838

3939
// file_put_contents('tests/data/injected', $inject);
40-
is( file_get_contents('tests/data/injected'), $inject->__toString() );
40+
$this->assertEquals( file_get_contents('tests/data/injected'), $inject->__toString() );
4141

4242
$inject->read();
43-
is( file_get_contents('tests/data/injected'), $inject->__toString() );
43+
$this->assertEquals( file_get_contents('tests/data/injected'), $inject->__toString() );
4444

4545
$inject->write();
46-
is( file_get_contents('tests/data/injected'), $inject->__toString() );
46+
$this->assertEquals( file_get_contents('tests/data/injected'), $inject->__toString() );
4747

4848

4949
$inject->replaceContent('');
5050
$inject->write();
5151

5252
// file_put_contents('tests/data/replaced',$inject);
53-
is( file_get_contents('tests/data/replaced'), $inject->__toString() );
53+
$this->assertEquals( file_get_contents('tests/data/replaced'), $inject->__toString() );
5454

5555

5656
// TODO test the content

tests/data/class_simple.fixture

+6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
<?php
2+
23
namespace Foo;
4+
35
class Bar2
46
{
7+
58
public $record = 'Product';
9+
610
public $fields = array (
711
0 => 'lang',
812
1 => 'name',
913
);
14+
1015
public function getTwo()
1116
{
1217
return 2;
1318
}
19+
1420
public function getFoo($i)
1521
{
1622
return $i;

0 commit comments

Comments
 (0)