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
Создание модульных и интеграционных тестов | |
Создано и настроено окружение для использования Codeception как надстройки над PhpUnit, теперь мы можем писать тесты (не только модульные на чистом PhpUnit, но и интеграционные, требующие запущенного приложения), а ещё получать статистику по тому, какой процент кода у нас покрыт этими самыми тестами. | |
Команды: | |
vendor/bin/codecept run - запустить все тесты | |
vendor/bin/codecept run unit --coverage-html='coverage' - сформировать отчёт по степени покрытия кода тестами | |
Контроллеры тонкие, их тестировать не нужно, да и нет возможности, потому что тесты запускаются в консоли, а там нет: веб-сервера, урла, сессий, куков и т.п. Проект запускается как консольное приложение. Так что всё сошлось. | |
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
usort($res, function ($a, $b) | |
{ | |
return strcmp($a["LastName"], $b["LastName"]); | |
}); |
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
preg_match('/\((.+)\)/', $str, $m); | |
echo $m[1]; |
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
function Latin(obj) { | |
if (/^[a-zA-Z0-9 ,.\-:"()]*?$/.test(obj.value)) | |
obj.defaultValue = obj.value; | |
else | |
obj.value = obj.defaultValue; | |
} | |
<input onkeyup="Latin(this);"> |
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
<div class="star-ratings-sprite"> | |
<span style="width:90%" class="star-ratings-sprite-rating"></span> | |
</div> | |
.star-ratings-sprite { | |
background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/2605/star-rating-sprite.png") repeat-x; | |
font-size: 0; | |
height: 21px; | |
line-height: 0; | |
overflow: hidden; |
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
$title = mb_strimwidth($title, 0, 85, "..."); |
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
?> | |
<h1>Отзывы</h1> | |
<ul id="tabs"> | |
<li><a title="tab1" href="#">Опубликованные отзывы</a></li> | |
<li><a title="tab2" href="#">Неопубликованные отзывы</a></li> | |
</ul> | |
<div id="content"> | |
<?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
?> | |
<style> | |
#content{ | |
width:820px; | |
} | |
ul{ | |
margin: 0; | |
border: 1px solid #d8d8d8; | |
padding-left: 0; |
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
Подключение эквайринга | |
Необходимо получить от клиента доступы в кабинет пользователя нужной платежной системы. | |
Для webpay сначала дается доступ к тестовому кабинету. В нем проверяется правильность подключения и деньги не списываются при оплате. Когда все готово и работает – клиент пишет в webpay, и ему дают доступы от рабочего кабинета. | |
Для bepaid кабинет один. | |
Произвести необходимую настройку в кабинете пользователя платежной системы. | |
Для webpay - задать секретный ключ, прописать страницы error, success, notify. Забираем из кабинета id магазина. | |
Для bepaid надо в кабинете настроить данные тестового платежа – срок действия тестовой карточки и прочее. Также забираем 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
Для eForm (evolutionCMS). | |
Создаем сниппет checkSpamTime, вставляем в него код: | |
<?php | |
if ($_SESSION['now']) | |
{ | |
$_SESSION['lt'] = $_SESSION['now']; | |
} | |
$_SESSION['now'] = microtime(true); |
NewerOlder