Skip to content

Instantly share code, notes, and snippets.

View DavertMik's full-sized avatar
🤓
developing codeception & codeceptjs

Michael Bodnarchuk DavertMik

🤓
developing codeception & codeceptjs
View GitHub Profile
@DavertMik
DavertMik / gist:5459174
Last active December 16, 2015 15:50
Symfony Container is recreated on each request!

In Codeception functional tests we use Symfony Container to access Profiler and Doctrine to check for different data. But looks like in Symfony2 container is rebuilt on every request. So no Doctrine and no Profiler now :( Is that intentional?

Here is the stack trace I see trying to execute Symfony2 functional tests over Codeception

We start with creating Kernel and Client (in Codeception\Module\Symfony2):

<?php
$this->kernelClass = $this->getKernelClass();
$this->kernel = new $this->kernelClass('test', true);
@DavertMik
DavertMik / main.js
Created May 8, 2013 13:48
kango.main.js
function Mailican() {
var self = this;
kango.ui.browserButton.setPopup({url:'popup.html', width: 400, height: 400 });
kango.ui.browserButton.addEventListener(kango.ui.browserButton.event.COMMAND, function(){self._onCommand();});
}
Mailican.prototype = {
_onCommand: function() {
}
};
@DavertMik
DavertMik / popup.html
Created May 8, 2013 13:51
popup.html assets
<head>
<script type="text/javascript" src="kango-ui/kango_api.js"></script>
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="underscore-min.js"></script>
<script type="text/javascript" src="backbone-min.js"></script>
<script type="text/javascript" src="popup.js"></script>
<link rel="stylesheet" href="foundation.min.css">
<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
@DavertMik
DavertMik / popup.js
Created May 8, 2013 13:59
kango ready popup api
KangoAPI.onReady(function() {
$('html').delegate('#visit', 'click', function() {
kango.browser.tabs.create({url:'http://mailican.com/'});
});
$('html').delegate('#signin', 'click', function() {
kango.browser.tabs.create({url:'http://mailican.com/signin'});
});
@DavertMik
DavertMik / popup.js
Last active December 17, 2015 03:08
kango user model
User = Backbone.Model.extend({
fetch: function() {
var xhr = {
url: 'http://mailican.com/api/user.json',
method: 'GET',
async: true,
contentType: 'json'
};
var self = this;
kango.xhr.send(xhr, function(data) {
@DavertMik
DavertMik / popup.js
Last active December 17, 2015 03:08
mail model
Mail = Backbone.Model.extend({
domain: function() {
return "@mailican.com";
},
local: function() {
return user.get('name')+"."+this.get('alias');
}
});
@DavertMik
DavertMik / popup.js
Created May 8, 2013 14:11
signin view
// views
SignInView = Backbone.View.extend({
el: $('body'),
template: _.template($('#signin-template').html()),
render: function() {
this.$el.html(this.template());
}
});
@DavertMik
DavertMik / popup.js
Last active December 17, 2015 03:08
launch popup
var mails = new MailCollection();
var user = new User();
var mailsView = new MailCollectionView({collection: mails});
var form = new MailFormView({});
user.fetch({success: function() {
mails.fetch({success: function() {
mailsView.render();
}});
}});
@DavertMik
DavertMik / file.php
Last active December 17, 2015 06:48
Codeception resolving naming collisions in aliases. RFC
<?php
// resolving naming collisions with aliases
$I->seeInDatabase()
$I->click_usingSelenium2()
$I->click_Selenium2()
$I->seeInDatabase() // default
$I->seeInDatabase_usingDb() // optional
$I->seeInDatabase_usingSecondDb() // for extended class
$I->seeInDatabase_SecondDb() //shortcut for _usingSecondDb
@DavertMik
DavertMik / CreatePostCept.php
Created May 20, 2013 21:32
laravel test with CSS
<?php
$I = new TestGuy($scenario);
$I->wantTo('perform actions and see result');
$I->amOnPage('/posts');
$I->see('All Posts');
$I->click('Add new post');
$I->fillField('#title', 'Hello world again');
$I->fillField('Body:', 'And greetings for all');
$I->click('Submit');
$I->see('All Posts');