This file contains hidden or 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
<?php | |
class PostController | |
{ | |
public function index() | |
{ | |
$posts = Post::where('date', '>', Carbon::now()->subDays(7))->get(); | |
return View::make('users.show', compact('posts')); | |
} | |
// ... |
This file contains hidden or 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
<?php | |
class PostRepository | |
{ | |
public function getRecent() | |
{ | |
return Post::where('date', '>', Carbon::now()->subDays(7))->get(); | |
} | |
public function getRecentFor($user_id) |
This file contains hidden or 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
<?php | |
/* UserRepository.php */ | |
namespace Acme\Repositories; | |
class UserRepository extends AbstractRepository implements UserRepositoryInterface | |
{ | |
// etc... | |
} |
This file contains hidden or 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
<?php | |
/** ... etc ... */ | |
class FeatureContext implements SnippetAcceptingContext | |
{ | |
protected $filesystem; | |
protected $config; | |
protected $sut; |
This file contains hidden or 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
Feature: Configuration Files | |
In order to configure my application | |
As a developer | |
I need to be able to store configuration options in a file | |
Scenario: Getting a configured option | |
Given there is a configuration file | |
And the option 'timezone' is configured to 'UTC' | |
When I load the configuration file | |
Then I should get 'UTC' as 'timezone' option |
This file contains hidden or 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
<?php | |
use Behat\Behat\Tester\Exception\PendingException; | |
use Behat\Behat\Context\SnippetAcceptingContext; | |
use Behat\Gherkin\Node\PyStringNode; | |
use Behat\Gherkin\Node\TableNode; | |
use org\bovigo\vfs\vfsStream; | |
/** |
This file contains hidden or 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
<?php | |
namespace spec; | |
use PhpSpec\ObjectBehavior; | |
use Prophecy\Argument; | |
class ConfigSpec extends ObjectBehavior | |
{ | |
function it_is_initializable() |
This file contains hidden or 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
<?php | |
class Config | |
{ | |
protected $settings; | |
public function __construct($settings = array()) | |
{ | |
$this->settings = $settings; | |
} |
This file contains hidden or 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
<?php | |
// ... etc | |
// in bootstrap/start.php | |
$env = $app->detectEnvironment(function () | |
{ | |
return getenv('APP_ENV'); | |
}); |
This file contains hidden or 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
<?php | |
// ... etc | |
// in bootstrap/start.php | |
$env = $app->detectEnvironment(function () | |
{ | |
return require __DIR__.'/environment.php'; | |
}); |