Categories
Laravel Samuel Test Driven Laravel Series

List Of Hard Stops In Test Driven Laravel Series

We have recently started a new continuing education series called Test Driven Laravel. Only a few episodes in and this has already proved to be an excellent and well made series of tutorials. If you would like to check this series out head over to https://adamwathan.me/test-driven-laravel/

First Hard Stop:

Setting up blank laravel install using the Laravel Composer Tool. Written about here

Second Hard Stop:

on the “getting green” episode once we have created a provider, a controller and a view we get to the point where we need to add $concert = Concert::find($id);

For my local install this causes an issue when we run the test ./vendor/bin/phpunit.

I get the error Fatal error: Class 'App\Http\Controllers\Concert' not found

Fix for this Written about here

Third Hard Stop
On the unit testing presentation logic episode anytime the test snippet is run we keep getting the same error even after we have created a new file in test/unit/ConcertTest.php and followed along with all of Adams steps we keep getting the same error when running the test command:

./vendor/bin/phpunit

We get the error:

Failed asserting that the page contains the HTML [December 6, 2016]. Please check the content above.

Fix for this written about here

Fourth Hard Stop

When we get past the previous ** error we run into an issue on the very last test of this episode. When Adam runs the last test he gets all greens and the lesson is over, when we run the test we get:

ConcertTest::can_get_formatted_date
Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 1 no such table: concerts

This was an issue in the very beginning of the lesson where we forgot to add in use DatabaseMigrations;. You will want to add this code to the ConcertTest.php inside of the ConcertTest class.

Fifth Hard Stop

Setting up phpstorm to run unit tests instead of running them in the command line, this allows us to run individual tests instead of all the tests at once

Categories
Laravel Samuel

Setting Up the Laravel Installer On Windows with Wamp Server

If you are struggling to get the laravel installer working on wamp server you have come to the right place. We just got done struggleing with this setup and took detailed notes:

Step 1: Install Laravel installation tool via composer.

Open Git Bash then run: composer global require "laravel/installer"

**If you do not have composer installed on your computer yet you can circle back to our initial laravel 4 wamp setup guide

Step 2: Try to run Laravel Installer (it will most likely error out during this first try)

-navigate to your wamp > www directory then open up gitbash. Type the following code:
laravel new folder-name
*replace folder-name with your actual desired folder name

**At this point we will most likely get the error message: Bash: Laravel: command not found**

Step 3: Fix our Error message

To fix this error message we will need to set our environment variables and allow the laravel installer commands to be executed. To do this follow these steps:

On windows 7:

1.) hit start > then type environment variables into the search bar and click on the link that pops up. This will take you too this screen:
mtgad

2.) find the “Path” variable from the list, click on it to highlight it and then click edit. This will take you to this screen:
9z8nb

3.) navigate to the end of the line and add a ; then type into the following: C:\Users\computer-name\AppData\Roaming\Composer\vendor\bin (*replace computer name with your computer name).

Time to Install Laravel!

No circle back and run the code from step 2:
laravel new.

Make sure to run this inside the folder where you would like your new laravel project made. If all goes correctly you will see the laravel installer execute.

**if you get an error, try simply typing “Laravel” into your command prompt. If that errors out, close your gitbash window and re-open it.

Categories
Fixing Stuff Laravel Samuel

Fixing Cron Job Error on Laravel 5.1 application

Background: We updated to php from 5.2 to 5.6 and our cron job starting firing an error. The steps taken to fix this are:

1.) Verify that argc_argv is set to =”On” in the default server php.ini file.

2.) Modify the cron job command:

original: php /home/username/path-to-laravel/artisan schedule:run >> /dev/null 2>&1

updated: php -d register_argc_argv=On /home/username/path-to-laravel/artisan schedule:run >> /dev/null 2>&1

——Update 11/30/2016——

We had issues with this cron again and the way to fix things was the following:

1.) login to WHM and navigate to MultiphpINI Editor > Editor Mode
2.) Select the current system default version of PHP (if not sure navigate to the Multiphp Manager page and it displays the system default at the top)
3.) On Editor Mode page navigate to Line 654 and set register_argc_argv = On

Save the file and your done.

Useful Testing info:

In this process I needed to figure out how to run an individual command from the laravel scheduler…. since the scheduler was set to only run the command I needed once per day I just wanted to manually run that command. To Do this we open up the actual command file:

app > console > commands and then find the command file you want. Then open the file up and find the “protected name”

command to run on the server:
php artisan 'protected name'. *note include the quotes when you copy this into your SSH terminal.

Categories
Fixing Stuff Laravel

Link to PDF document in laravel 5 blade file

this is a pretty simple issue but just wanted to jot down this note in case anyone out there is trying to link to an image or pdf asset in their laravel blade file and its not working. The process to do this looks like:

a href="{{ asset('/assets/folder-name/filename') }}" target="_blank"> Link Name

so for example if you had a PDF that you wanted to link to it would look like:

a href="{{ asset('/assets/folder-name/file-name.pdf') }}" target="_blank"> File Name

Categories
Fixing Stuff Julia

How to stop a Brinks/ADT alarm from beeping…even when it’s not active

So, for the past several weeks my landlord has said he would call about fixing the unused Brinks alarm system in our apartment. We’ve got two keypads and for the most part they were an eyesore when we moved in but otherwise worthless. Until they started beeping. Once every 12-18 hours long, loud beeps would occur until we pressed the cancel button on the keypad; in the middle of the night, as I was getting home from work and when I was home alone in the shower and thought maybe I was under attack…

Since my landlord was not moving fast enough (though apologetic) I decided to take matters into my own hands. In case anyone is running into the same issue, here’s how to disarm a disconnected alarm that won’t shut up!

1. Get a Phillips screw driver.

2. Locate the power box for the alarm. For me this was in a closet in my entryway. It looks like this:

image

3. Use the screwdriver to open the box, and once opened locate the battery. Pull the black cord off the battery (mine was pretty stuck, don’t be afraid to yank on it). Here’s what it looks like with the black cord unplugged from the top of the battery:

image

4. Look down from the box, or in my case if a hole with wires is drilled into the wall then look on the other side of the wall. You should see something that looks like a small white speaker plugged into an outlet. It’s screwed in, so grab that screw driver and unscrew it and the 4 wires on its backside once it’s free from the outlet/wall. Here’s what the box looks like.:

image

5. Push any wires into the wall, close up the power box and pour yourself a drink as you celebrate the lights on your alarm keypad going dead. No more beeping!! Your partner and nighbors will thank you.

And I thought I wasn’t handy. Boo-ya. Next up, trying not to die as I get a step stool at the top of my porch steps to figure out how to replace the light bulb in the Fort Knox of sconce lighting.

Categories
Books Julia

A good book

I just finished reading a book about a young girl whose grandmother dies and leaves the girl to find out about her life before she was a grandmother; and to learn the lesson of how this girl and her mother and grandmother are connected to the people who live in their 6 flat building. The way this kid (she’s 7) who’s a wise “old soul” does this is through realizing that the fairy tales her grandmother told her growing up had elements of truth to them. Left for her to decode on her own. It was reminiscent of the movie Big Fish, if you’ve seen that, where the dad tells fantastical stories that don’t turn out to be totally untrue. This kid is hilarious and way smarter than other kids her age and she gets picked on for it. Her grandmother used their stories so she’d have an escape and took her to imaginary lands where she could be the hero.

This book about the little girl and her grandma was about loss and love, how people are rooting for you when you don’t even know it, and it even tied in some magic and love for Harry Potter. When the dog dies, who from the girl’s vantage point is as big as a human, I cried so hard I couldn’t breathe. Not because I’m an animal lover but because it was the moment in the book when the girl realizes how much people (and not people) are trying to protect her despite their own lives they are trying to live. She learns that she isn’t the only one reeling from the loss of her grandmother, that other people knew her grandmother from another time and grieve her too. Like how my mom’s college roommate walks in a 5k for breast cancer every year with her daughter in memory of my mom, but from a time before my mom was a mom, and when she meant so much to this woman as a roommate and a friend. This book reminded you you of the power of a good story – both through the tales the grandmother created for her granddaughter and through the story of the girl finding truth in them.

go read: My Grandmother Asked Me To Tell You She’s Sorry.