This repository has been archived by the owner on Jan 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/zynga/zynga-hacklang-fram…
- Loading branch information
Showing
30 changed files
with
960 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/Zynga/Framework/Factory/V2/Test/Config/Mock/Reader/Base.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?hh // strict | ||
|
||
namespace Zynga\Framework\Factory\V2\Test\Config\Mock\Reader; | ||
|
||
use Zynga\Framework\Factory\V2\Config\Base as ConfigBase; | ||
use Zynga\Framework\Factory\V2\Test\Interfaces\ConfigInterface; | ||
|
||
abstract class Base extends ConfigBase implements ConfigInterface { | ||
public function getDriver(): string { | ||
return 'Mock'; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Zynga/Framework/Factory/V2/Test/Config/Mock/Reader/Dev.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?hh // strict | ||
|
||
namespace Zynga\Framework\Factory\V2\Test\Config\Mock\Reader; | ||
|
||
use Zynga\Framework\Factory\V2\Test\Config\Mock\Base as ConfigBase; | ||
|
||
class Dev extends ConfigBase { | ||
public function getExampleConfigValue(): string { | ||
return 'This-is-Dev-Reader'; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/Zynga/Framework/Factory/V2/Test/Config/Mock/Reader/DevTest.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?hh //strict | ||
|
||
namespace Zynga\Framework\Factory\V2\Test\Config\Mock\Reader; | ||
|
||
use Zynga\Framework\Testing\TestCase\V2\Base as TestCase; | ||
|
||
use Zynga\Framework\Factory\V2\Test\Config\Mock\Reader\Dev as TestConfig; | ||
|
||
class DevTest extends TestCase { | ||
public function test_configValues(): void { | ||
$obj = new TestConfig(); | ||
$this->assertEquals('This-is-Dev-Reader', $obj->getExampleConfigValue()); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Zynga/Framework/Factory/V2/Test/Config/Mock/Reader/Production.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?hh // strict | ||
|
||
namespace Zynga\Framework\Factory\V2\Test\Config\Mock\Reader; | ||
|
||
use Zynga\Framework\Factory\V2\Test\Config\Mock\Base as ConfigBase; | ||
|
||
class Production extends ConfigBase { | ||
public function getExampleConfigValue(): string { | ||
return 'This-is-Production-Reader'; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Zynga/Framework/Factory/V2/Test/Config/Mock/Reader/ProductionTest.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?hh //strict | ||
|
||
namespace Zynga\Framework\Factory\V2\Test\Config\Mock\Reader; | ||
|
||
use Zynga\Framework\Testing\TestCase\V2\Base as TestCase; | ||
|
||
use | ||
Zynga\Framework\Factory\V2\Test\Config\Mock\Reader\Production as TestConfig | ||
; | ||
|
||
class ProductionTest extends TestCase { | ||
public function test_configValues(): void { | ||
$obj = new TestConfig(); | ||
$this->assertEquals( | ||
'This-is-Production-Reader', | ||
$obj->getExampleConfigValue(), | ||
); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Zynga/Framework/Factory/V2/Test/Config/Mock/Reader/Staging.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?hh // strict | ||
|
||
namespace Zynga\Framework\Factory\V2\Test\Config\Mock\Reader; | ||
|
||
use Zynga\Framework\Factory\V2\Test\Config\Mock\Base as ConfigBase; | ||
|
||
class Staging extends ConfigBase { | ||
public function getExampleConfigValue(): string { | ||
return 'This-is-Staging-Reader'; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Zynga/Framework/Factory/V2/Test/Config/Mock/Reader/StagingTest.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?hh //strict | ||
|
||
namespace Zynga\Framework\Factory\V2\Test\Config\Mock\Reader; | ||
|
||
use Zynga\Framework\Testing\TestCase\V2\Base as TestCase; | ||
|
||
use Zynga\Framework\Factory\V2\Test\Config\Mock\Reader\Staging as TestConfig; | ||
|
||
class StagingTest extends TestCase { | ||
public function test_configValues(): void { | ||
$obj = new TestConfig(); | ||
$this->assertEquals( | ||
'This-is-Staging-Reader', | ||
$obj->getExampleConfigValue(), | ||
); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Zynga/Framework/Factory/V2/Test/Config/MockOverride/Base.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?hh // strict | ||
|
||
namespace Zynga\Framework\Factory\V2\Test\Config\MockOverride; | ||
|
||
use Zynga\Framework\Factory\V2\Config\Base as ConfigBase; | ||
use Zynga\Framework\Factory\V2\Test\Interfaces\ConfigInterface; | ||
|
||
abstract class Base extends ConfigBase implements ConfigInterface { | ||
public function getDriver(): string { | ||
return 'Mock'; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Zynga/Framework/Factory/V2/Test/Config/MockOverride/Dev.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?hh // strict | ||
|
||
namespace Zynga\Framework\Factory\V2\Test\Config\MockOverride; | ||
|
||
use Zynga\Framework\Factory\V2\Test\Config\MockOverride\Base as ConfigBase; | ||
|
||
class Dev extends ConfigBase { | ||
public function getExampleConfigValue(): string { | ||
return 'This-is-overridden-Dev'; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Zynga/Framework/Factory/V2/Test/Config/MockOverride/DevTest.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?hh //strict | ||
|
||
namespace Zynga\Framework\Factory\V2\Test\Config\MockOverride; | ||
|
||
use Zynga\Framework\Testing\TestCase\V2\Base as TestCase; | ||
|
||
use Zynga\Framework\Factory\V2\Test\Config\MockOverride\Dev as TestConfig; | ||
|
||
class DevTest extends TestCase { | ||
public function test_configValues(): void { | ||
$obj = new TestConfig(); | ||
$this->assertEquals( | ||
'This-is-overridden-Dev', | ||
$obj->getExampleConfigValue(), | ||
); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Zynga/Framework/Factory/V2/Test/Config/MockOverride/Production.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?hh // strict | ||
|
||
namespace Zynga\Framework\Factory\V2\Test\Config\MockOverride; | ||
|
||
use Zynga\Framework\Factory\V2\Test\Config\MockOverride\Base as ConfigBase; | ||
|
||
class Production extends ConfigBase { | ||
public function getExampleConfigValue(): string { | ||
return 'This-is-overridden-Production'; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Zynga/Framework/Factory/V2/Test/Config/MockOverride/ProductionTest.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?hh //strict | ||
|
||
namespace Zynga\Framework\Factory\V2\Test\Config\MockOverride; | ||
|
||
use Zynga\Framework\Testing\TestCase\V2\Base as TestCase; | ||
|
||
use | ||
Zynga\Framework\Factory\V2\Test\Config\MockOverride\Production as TestConfig | ||
; | ||
|
||
class ProductionTest extends TestCase { | ||
public function test_configValues(): void { | ||
$obj = new TestConfig(); | ||
$this->assertEquals( | ||
'This-is-overridden-Production', | ||
$obj->getExampleConfigValue(), | ||
); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Zynga/Framework/Factory/V2/Test/Config/MockOverride/Staging.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?hh // strict | ||
|
||
namespace Zynga\Framework\Factory\V2\Test\Config\MockOverride; | ||
|
||
use Zynga\Framework\Factory\V2\Test\Config\MockOverride\Base as ConfigBase; | ||
|
||
class Staging extends ConfigBase { | ||
public function getExampleConfigValue(): string { | ||
return 'This-is-overridden-Staging'; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Zynga/Framework/Factory/V2/Test/Config/MockOverride/StagingTest.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?hh //strict | ||
|
||
namespace Zynga\Framework\Factory\V2\Test\Config\MockOverride; | ||
|
||
use Zynga\Framework\Testing\TestCase\V2\Base as TestCase; | ||
|
||
use | ||
Zynga\Framework\Factory\V2\Test\Config\MockOverride\Staging as TestConfig | ||
; | ||
|
||
class StagingTest extends TestCase { | ||
public function test_configValues(): void { | ||
$obj = new TestConfig(); | ||
$this->assertEquals( | ||
'This-is-overridden-Staging', | ||
$obj->getExampleConfigValue(), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?hh //strict | ||
|
||
namespace Zynga\Framework\PgData\V1; | ||
|
||
use Zynga\Framework\PgData\V1\Interfaces\PgModelInterface; | ||
|
||
abstract class PgModelFactory { | ||
private static ?PgModelInterface $_mock; | ||
|
||
public function getModel(): PgModelInterface { | ||
if (self::$_mock !== null) { | ||
return self::$_mock; | ||
} | ||
return $this->getRealModel(); | ||
} | ||
public static function enableMock(PgModelInterface $mock): void { | ||
self::$_mock = $mock; | ||
} | ||
|
||
public static function disableMock(): void { | ||
self::$_mock = null; | ||
} | ||
|
||
protected abstract function getRealModel(): PgModelInterface; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?hh //strict | ||
|
||
namespace Zynga\Framework\PgData\V1; | ||
|
||
use Zynga\Framework\PgData\V1\Interfaces\Sharded\PgModelInterface; | ||
use Zynga\Framework\Type\V1\Interfaces\TypeInterface; | ||
|
||
abstract class PgShardedModelFactory { | ||
private static ?PgModelInterface $_mock; | ||
|
||
public function __construct(private TypeInterface $_shardKey) {} | ||
|
||
public function getModel(): PgModelInterface { | ||
if (self::$_mock !== null) { | ||
return self::$_mock; | ||
} | ||
return $this->getRealModel(); | ||
} | ||
|
||
public static function enableMock(PgModelInterface $mock): void { | ||
self::$_mock = $mock; | ||
} | ||
|
||
public static function disableMock(): void { | ||
self::$_mock = null; | ||
} | ||
|
||
protected abstract function getRealModel(): PgModelInterface; | ||
|
||
} |
Oops, something went wrong.