« Les fous, les marginaux, les rebelles, les anticonformistes, les dissidents, tous ceux qui voient les choses différemment, qui ne respectent pas les règles, vous pouvez les admirer ou les désapprouver, les glorifier ou les dénigrer, mais vous ne pouvez pas les ignorer. Car ils changent les choses, ils inventent, ils imaginent, ils explorent, ils créent, ils inspirent, ils font avancer l'humanité. Là où certains ne voient que folie, nous voyons du génie. Car seuls ceux qui sont assez fous pour penser qu'ils peuvent changer le monde, y parviennent » Think Different, Apple Computer
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
<?php | |
namespace tests\units; | |
require __DIR__ . '/../../order.php'; | |
require __DIR__ . '/mageekguy.atoum.phar'; | |
use | |
mageekguy\atoum | |
; |
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
// First install the atoum plugin (https://github.com/atoum/atoum/wiki/atoum-et-VIM) | |
// Second, add these lines to your .vimrc or (much better) to your php ftplugin : | |
nnoremap <buffer> <silent> <CR> :Atoum<CR> // Using <Enter> run atoum for all methods of the current file | |
nnoremap <buffer> <silent> <C-CR> :Atoum --debug<CR> Using <Ctrl-Enter> run atoum in debug mode for all methods of the current file (https://github.com/atoum/atoum/wiki/Le-mode-%22debug%22) | |
nnoremap <buffer> <silent> <S-CR> :execute ':Atoum -m *::' . substitute(getline(search('.*function\s\+test[^(]\+(', 'cnb')), '.*function\s\+\(test[^(]\+\)(.*$', '\1', '')<CR> // Using <Shift-Enter> run atoum only for the current method of the current file, ie the method which has the cursor in it |
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
<?php | |
$remoteFile = file_get_contents('ssh2.sftp://user:[email protected]:22/path/to/file'); | |
// See http://php.net/manual/en/wrappers.ssh2.php for more informations. |
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
function! s:GitPrevious() | |
let _ = './' . expand('%') | |
let filetype = &filetype | |
execute ':silent! vsp ' . tempname() | |
execute ':silent! 0r !git show HEAD~1:' . _ | |
execute ':silent! $d' | |
execute ':silent! set nomodifiable' | |
execute ':silent! set readonly' | |
execute ':silent! set ft=' . filetype |
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
static public function relativise($path, $workingpath = null) { | |
if(is_null($workingpath)) $workingpath = self::CorrectPathSlashes(getcwd()); | |
$path = preg_replace('#([^/]+/\.\.)#', '', $path); | |
$path = preg_replace('#(\./|/\.$)#', '', $path); | |
$path = preg_replace('#/{2,}#', '/', $path); | |
$path = preg_replace('#/$#', '', $path); | |
$workingpath = preg_replace('#([^/]+/\.\.)#', '', $workingpath); | |
$workingpath = preg_replace('#(\./|/\.$)#', '', $workingpath); | |
$workingpath = preg_replace('#/{2,}#', '/', $workingpath); |
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
public function getRelativePathFrom(self $reference) | |
{ | |
$referencePath = static::cleanPath($reference); | |
switch (true) | |
{ | |
case $this->path == $referencePath: | |
return '.'; | |
case $referencePath == '': |
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
<?php | |
namespace tests\units; | |
require __DIR__ . '/../runner.php'; | |
use | |
atoum, | |
path as testedClass | |
; |
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
protected function mockAllSubLogMethods(atoum\mock\aggregator $mock) | |
{ | |
$controller = $mock->getMockController(); | |
foreach ($controller->getMockedMethods() as $method) | |
{ | |
if ($method !== 'log') | |
{ | |
$controller->{$method} = function() {}; | |
} |
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
<?php | |
$php = proc_open('php', array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w')), $pipes); | |
fwrite($pipes[0], '<?php '); | |
for ($i = 0; $i <= 9000; $i++) | |
{ | |
fwrite($pipes[0], '/'); | |
} |