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 | |
/** | |
* Generates the random string specified length | |
* @param int $length | |
* | |
* @return string | |
*/ | |
protected function getRandomString($length) | |
{ |
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
test: | |
doctrine: | |
param: | |
dsn: 'sqlite::memory:' | |
# dsn: 'mysql:host=localhost;dbname=clipkit_dev' | |
# dsn: 'sqlite:%SF_DATA_DIR%/test-doctrine.db' | |
statistic: | |
param: | |
dsn: 'sqlite::memory:' | |
tracking: |
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
doctrine: | |
dbal: | |
default_connection: default | |
connections: | |
default: | |
driver: pdo_sqlite | |
memory: true | |
# path: %kernel.cache_dir%/test-default.db | |
charset: UTF8 |
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 | |
testDisplay() | |
{ | |
... | |
//I use 25000 for the timeout but anything else works too it depends on your loading page | |
$this->timeouts()->implicitWait(25000); | |
$this->assertContains('toto42', $this->source()); | |
... | |
} |
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 ClipKit\Test; | |
/** | |
* Base class for the selenium tests | |
* | |
* @author Serhiy Hlushko <[email protected]> | |
*/ | |
abstract class WebTestCase extends \PHPUnit_Framework_TestCase |
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 | |
// 1st solution | |
namespace SomeBundle; | |
use Symfony\Component\HttpKernel\Bundle\Bundle; | |
use Doctrine\DBAL\Types\Type; | |
class CormesClipkitTestBundle extends Bundle | |
{ |
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 | |
$qb = $this->get('doctrine.orm.entity_manager')->createQueryBuilder(); | |
$qb->select('v.id') | |
->from('CormesClipkitApiBundle:Video', 'v') | |
->where('IDENTITY(v.user) in (?1)') | |
->setParameter(1, $coIds) | |
->setFirstResult(rand(0, $count - $resnum)) | |
->setMaxResults($resnum); | |
$result = $qb->getQuery()->getResult(); |
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
Twig: | |
{% javascripts '@AcmeFooBundle/Resources/public/js/*' %} | |
<script type="text/javascript" src="{{ asset_url }}"></script> | |
{% endjavascripts %} | |
{% stylesheets '@AcmeFooBundle/Resources/public/css/*' %} | |
<link rel="stylesheet" href="{{ asset_url }}" /> | |
{% endstylesheets %} | |
PHP: |
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
Twig: | |
{# app/Resources/views/base.html.twig #} | |
{# ... #} | |
<div id="sidebar"> | |
{% render "AcmeArticleBundle:Article:recentArticles" with {'max': 3} %} | |
</div> | |
PHP: |
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
Twig: | |
<img src="{{ asset('images/logo.png') }}" alt="Symfony!" /> | |
<link href="{{ asset('css/blog.css') }}" rel="stylesheet" type="text/css" /> | |
PHP: | |
<img src="<?php echo $view['assets']->getUrl('images/logo.png') ?>" alt="Symfony!" /> | |
<link href="<?php echo $view['assets']->getUrl('css/blog.css') ?>" rel="stylesheet" type="text/css" /> | |
NewerOlder