Book Image

Magento PHP Developer's Guide

By : Allan MacGregor
Book Image

Magento PHP Developer's Guide

By: Allan MacGregor

Overview of this book

<p>Magento has completely reshaped the face of e-commerce since its launch in 2008. Its revolutionary focus on object oriented and EAV design patterns has allowed it to become the preferred tool for developers and retailers alike.</p> <p>"Magento PHP Developer’s Guide" is a complete reference to Magento, allowing developers to understand its fundamental concepts, and get them developing and testing Magento code.</p> <p>The book starts by building the reader’s knowledge of Magento, providing them with the information, techniques, and tools that they require to start their first Magento development.</p> <p>After building this knowledge, the book will then look at more advanced topics: how to test your code, how to extend the frontend and backend, and deploying and distributing custom modules.</p> <p>"Magento PHP Developer’s Guide" will help you navigate your way around your first Magento developments, helping you to avoid all of the most common headaches new developers face when first getting started.</p>
Table of Contents (16 chapters)
Magento PHP Developer's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating our first test


Mink tests are also stored inside the Test folder. Let's create the base skeleton of our Mink test class:

  1. Navigate to the Test folder on our module root.

  2. Create a new directory called Mink.

  3. Inside the Mink directory, create a new PHP class called Registry.php.

  4. Copy the following code (the file location is app/code/local/Mdg/Giftregistry/Test/Mink/Registry.php):

    <?php
    class Mdg_Giftregistry_Test_Mink_Registry extends JR_Mink_Test_Mink 
    {   
        public function testAddProductToRegistry()
        {
            $this->section('TEST ADD PRODUCT TO REGISTRY');
            $this->setCurrentStore('default');
            $this->setDriver('goutte');
            $this->context();
     
            // Go to homepage
            $this->output($this->bold('Go To the Homepage'));
            $url = Mage::getStoreConfig('web/unsecure/base_url');
            $this->visit($url);
            $category = $this->find('css', '#nav .nav-1-1 a');
            if (!$category) {
                return false;
            }...