コード例 #1
0
ファイル: PropertyTest.php プロジェクト: lucidphp/writer
    /** @test */
    public function itShouldHaveAnInitialValueAndType()
    {
        $prop = new Property('foo');
        $expected = <<<PHP
    /** @var string */
    private \$foo = 'foo';
PHP;
        $prop->setValue("'foo'");
        $prop->setType(Property::T_STRING);
        $prop->setVisibility(Property::IS_PRIVATE);
        $this->assertSame($expected, (string) $prop);
    }
コード例 #2
0
ファイル: ClassWriterTest.php プロジェクト: lucidphp/writer
 /** @test */
 public function itShouldHaveProperties()
 {
     $cg = $this->newObw('Foo', 'Acme');
     $cg->noAutoGenerateTag();
     $cg->setProperties([new Property('bar', Property::IS_PRIVATE), $p = new Property('baz', Property::IS_PUBLIC, 'string')]);
     $p->setValue("'baz'");
     $this->assertEquals($this->getContents('class.3.php'), $cg->generate());
 }