-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0eb11cd
commit cb2e170
Showing
7 changed files
with
106 additions
and
78 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,13 @@ | ||
<?php | ||
|
||
namespace Pre\ParameterLoaders; | ||
|
||
use Pre\Testing\Runner; | ||
|
||
class SpecTest extends Runner | ||
{ | ||
protected function path(): string | ||
{ | ||
return __DIR__ . "/specs"; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,14 @@ | ||
<?php | ||
|
||
namespace Yay; | ||
|
||
// let's use a namespace trick, to make non-colliding variables predictable. | ||
|
||
function md5($value) | ||
{ | ||
return $value; | ||
} | ||
|
||
putenv("PRE_BASE_DIR=" . __DIR__ . "/.."); | ||
|
||
require __DIR__ . "/../vendor/autoload.php"; |
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,83 @@ | ||
--DESCRIPTION-- | ||
|
||
Test parameter loader macros | ||
|
||
--GIVEN-- | ||
|
||
class Fixture | ||
{ | ||
public function typeHintedRegular(string $string = "typeHintedRegular") | ||
{ | ||
return "working"; | ||
} | ||
|
||
public function typeHintedEnhanced(stdClass $object = new stdClass()) | ||
{ | ||
return "working"; | ||
} | ||
|
||
public function multipleRegular($one = "one", $two = 2.2, $three = true, $four = null) | ||
{ | ||
return "working"; | ||
} | ||
|
||
public function multipleEnhanced($one = ucwords("one"), $two = round(2.2)) | ||
{ | ||
return "working"; | ||
} | ||
|
||
public function mixed($one, $two = 2.2, $three = round(3.3), $four = new stdClass) | ||
{ | ||
return "working"; | ||
} | ||
} | ||
|
||
--EXPECT-- | ||
|
||
class Fixture | ||
{ | ||
public function typeHintedRegular(string $string ="typeHintedRegular") | ||
{ | ||
return "working"; | ||
} | ||
|
||
public function typeHintedEnhanced(stdClass $object = null) | ||
{ | ||
if (is_null($object)) { | ||
$object = new stdClass(); | ||
} | ||
|
||
return "working"; | ||
} | ||
|
||
public function multipleRegular($one ="one", $two =2.2, $three =true, $four =null) | ||
{ | ||
return "working"; | ||
} | ||
|
||
public function multipleEnhanced($one = null, $two = null) | ||
{ | ||
if (is_null($one)) { | ||
$one = ucwords("one"); | ||
} | ||
|
||
if (is_null($two)) { | ||
$two = round(2.2); | ||
} | ||
|
||
return "working"; | ||
} | ||
|
||
public function mixed($one, $two =2.2, $three = null, $four = null) | ||
{ | ||
if (is_null($three)) { | ||
$three = round(3.3); | ||
} | ||
|
||
if (is_null($four)) { | ||
$four = new stdClass ; | ||
} | ||
|
||
return "working"; | ||
} | ||
} |