Skip to content

Instantly share code, notes, and snippets.

View elnur's full-sized avatar
🤓

Elnur Abdurrakhimov elnur

🤓
  • Earth
View GitHub Profile
<?php
class TestCase extends PHPUnit_Framework_TestCase
{
private $browser;
protected function setUp()
{
$this->browser = new Browser('firefox');
}
@elnur
elnur / SuperUser.php
Last active August 29, 2015 14:01
How to Enable the Underscore Naming Strategy for Doctrine ORM in Symfony http://elnur.pro/how-to-enable-the-underscore-naming-strategy-for-doctrine-orm-in-symfony/
<?php
class SuperUser
{
private $firstName;
private $lastName;
}
require "yaml"
params = YAML::load_file("./Vagrantparams.yml")
Vagrant.configure("2") do |config|
config.vm.network "private_network", :ip => params['ip']
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", params['memory']]
vb.customize ["modifyvm", :id, "--cpus", params['cpus']]
<?php
class EmailDomainExtractor implements EmailDomainExtractorInterface
{
/**
* @param string $email
* @return string
*/
public function extract($email)
{
@elnur
elnur / build.gradle
Created May 14, 2014 17:06
Separating Different Types of Tests in Gradle
sourceSets {
apiTest {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
}
configurations {
apiTestCompile.extendsFrom testCompile
apiTestRuntime.extendsFrom testRuntime
doctrine:
orm:
auto_generate_proxy_classes: "%kernel.debug%"
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
model:
type: annotation
dir: %kernel.root_dir%/../src/Site/Model
prefix: Site\Model
Feature: Discounts for customers
In order to be more motivated to buy more stuff in this shop
As a customer
I want to get discounts when I buy lots of stuff
Scenario: Provide a $10 discount when buying goods for more than $100
Given I'm a customer
And category "Pure Awesomeness" exists
And product "Super Awesome Stuff" exists
And product "Super Awesome Stuff" is in the "Pure Awesomeness" category
@elnur
elnur / login.feature
Created May 14, 2014 13:03
Aweful UI ridden scenario
Scenario: Successful login
Given a user "Elnur" with password "sw0rdf1sh"
And I am on "/app_test.php/login"
And I fill in "User name" with "Elnur"
And I fill in "Password" with "sw0rdf1sh"
When I press "Log in"
Then the status code should be 200
And I should be on "/app_test.php/home"
And I should see "Welcome, Elnur"
<?php
namespace Example\Manager;
use JMS\DiExtraBundle\Annotation\Inject;
use JMS\DiExtraBundle\Annotation\InjectParams;
use JMS\DiExtraBundle\Annotation\Service;
use Example\Model\User;
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
/**
<?php
namespace Example\Manager;
use JMS\DiExtraBundle\Annotation\Inject;
use JMS\DiExtraBundle\Annotation\InjectParams;
use JMS\DiExtraBundle\Annotation\Service;
use Example\Model\User;
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
/**