Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* This test addresses the following function requirements:
* Given that an Account is created (properly filled out and saved) then
* the DBA field (dba_c) should be populated with the name that was provided
* for the Account name
*
* This is a pretty common type of Sugar customization/enhancement that I've come
* across, so this test is how I would validate that my logic hook is working
@mfrost503
mfrost503 / AccountHook.php
Created October 9, 2012 15:35
Account Logic Hook
<?php
/**
* This account hook would be run before save
**/
class AccountHook
{
public function setDBAName($bean,$event,$arguments)
{
$bean->dba_c = $bean->name;
@mfrost503
mfrost503 / bdd_story_1
Created October 28, 2012 02:23
BDD Story 1
/**
* @test
* Given that we're provided a valid number in miles
* Then we should be able to retrieve the kilometer equivalent
* @dataProvider getMilesToKm
**/
public function ConvertMilesToKilometers($miles,$expected)
{
$this->distance
@mfrost503
mfrost503 / bdd_story_2
Created October 28, 2012 02:36
BDD Story 2
/**
* @test
* Given that we're provided a valid number in kilometers
* Then we should be able to retrieve the miles equivalent
* @dataProvider getKmToMiles
**/
public function ConvertMilesToKilometers($km,$expected)
{
$this->distance
>>> import socket
>>> s=socket.socket()
>>> s.connect(("irc.freenode.net",6667))
>>> s.send("NICK :%s\r\n" % "testbot")
15
>>> s.send("USER %s %s bla :%s\r\n" % ("testbot","irc.freenode.net","testbot"))
44
>>> s.send("JOIN :%s\r\n" % "#dayly")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
':wright.freenode.net NOTICE * :*** Looking up your hostname...\r\n:wright.freenode.net NOTICE * :*** Checking Ident\r\n:wright.freenode.net NOTICE * :*** Found your hostname\r\n:wright.freenode.net NOTICE * :*** No Ident response\r\n:wright.freenode.net 437 * testbot :Nick/channel is temporarily unavailable\r\nERROR :Closing Link: c-67-176-185-20.hsd1.in.comcast.net (Connection timed out)\r\n'
set t_Co=256
set background=dark
set ruler
set number
set showcmd
set ts=4
set sw=4
encoding=utf-8
set ignorecase
@mfrost503
mfrost503 / gist:7177913
Created October 27, 2013 04:15
Logical Or
58 $this->db->expects($this->atLeastOnce())
59 ->method('prepare')
60 ->with($this->logicalOr(
61 $expectedQuery,
62 $teachingQuery,
63 $learningQuery
64 ))
65 ->will($this->returnValue($this->statement));
@mfrost503
mfrost503 / keybase.md
Created March 22, 2014 22:24
keybase.md

Keybase proof

I hereby claim:

  • I am mfrost503 on github.
  • I am mfrost503 (https://keybase.io/mfrost503) on keybase.
  • I have a public key whose fingerprint is 722B 2AC6 4BA0 E048 DE78 3629 8C98 305D A3EC C888

To claim this, I am signing this object:

@mfrost503
mfrost503 / gist:9717307
Created March 23, 2014 01:40
Testing 1,2,3
-----BEGIN PGP MESSAGE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - https://gpgtools.org
hQEMA6iI+4dzsWkcAQf/adW2s35j3AWRokqRNbXC+We5wcsqEF46jX2+VWtvIbgV
CPzP1QqlLS6Wc5ofEezLozeFTj7XBJguPtComfDB4bYnO1pjG1SRS7Um2mMv/rZq
VNxA+9ggnuw9kymBB8mSQA4iLJUCVPw+NvECTKPQI2oNkgiMYvukKox7HpjOYRiv
jge2PPtVbfhoWNXNwGlskoW+q/MUJmdGBFaCPHw+f9VRFD4uetIJ1L5r65/GKFen
7XQE5si5JB/GtQKB91Nl1aDOAMjlbQn1b+49sLPwE60LCXYJdT2D1vtvvECT/nZm
WUM/w4u+U3L13+83oP50XQeZU6mK0lm6m3X9PPULYdLAzwEPwAht/EZthk9emcfd