Skip to content

Commit

Permalink
Merge pull request #2221 from zephir-lang/#1536-add-test-case
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexNDRmac committed Apr 18, 2021
2 parents c430914 + 459a05d commit 5433438
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 5 deletions.
24 changes: 24 additions & 0 deletions ext/stub/properties/staticprotectedproperties.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions ext/stub/properties/staticprotectedproperties.zep.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions stub/constantsparent.zep
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ namespace Stub;

class ConstantsParent
{

const P1 = null;

const P2 = false;
Expand All @@ -15,5 +14,4 @@ class ConstantsParent
const P5 = 10.25;

const P6 = "test";

}
17 changes: 16 additions & 1 deletion stub/properties/staticprotectedproperties.zep
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ namespace Stub\Properties;

class StaticProtectedProperties
{

/**
* This is a protected property with no initial value
*/
Expand Down Expand Up @@ -81,4 +80,20 @@ class StaticProtectedProperties
return self::someString;
}

/**
* @issue https://github.com/zephir-lang/zephir/issues/1536
*/
public function compareStaticNull() -> bool
{
var someNull;

let someNull = self::someNull;

if someNull === null {
let someNull = true;
return someNull;
}

return someNull;
}
}
4 changes: 2 additions & 2 deletions tests/Extension/Properties/StaticPropertyArrayTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of the Zephir.
*
Expand All @@ -11,6 +9,8 @@
* the LICENSE file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Extension\Properties;

use PHPUnit\Framework\TestCase;
Expand Down
35 changes: 35 additions & 0 deletions tests/Extension/Properties/StaticProtectedPropertiesTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

/**
* This file is part of the Zephir.
*
* (c) Phalcon Team <team@zephir-lang.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Extension\Properties;

use PHPUnit\Framework\TestCase;
use Stub\Properties\StaticProtectedProperties;

/**
* @issue https://github.com/zephir-lang/zephir/issues/1536
*/
final class StaticProtectedPropertiesTest extends TestCase
{
public function testCompareStaticNullOnBuiltIn(): void
{
$class = new StaticProtectedProperties();
$this->assertTrue($class->compareStaticNull());
}

public function testCompareStaticNullOnExtending(): void
{
$spp = new \TestStaticProtectedProperties();
$this->assertTrue($spp->compareStaticNull());
}
}
1 change: 1 addition & 0 deletions tests/fixtures/mocks/TestScopePhpMagicExtending.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/

class TestScopePhpMagicExtending extends TestScopePhpMagic
{
private $privateProperty2 = 'private2';
Expand Down
19 changes: 19 additions & 0 deletions tests/fixtures/mocks/TestStaticProtectedProperties.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/**
* This file is part of the Zephir.
*
* (c) Phalcon Team <team@zephir-lang.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/

use Stub\Properties\StaticProtectedProperties;

/**
* @issue https://github.com/zephir-lang/zephir/issues/1536
*/
class TestStaticProtectedProperties extends StaticProtectedProperties
{
}

0 comments on commit 5433438

Please sign in to comment.