Skip to content

Commit 31ae1d1

Browse files
committed
#14 more tests
1 parent cfe1b2f commit 31ae1d1

File tree

7 files changed

+213
-21
lines changed

7 files changed

+213
-21
lines changed

app/code/community/LeMike/DevMode/README.md

Whitespace-only changes.

app/code/community/LeMike/DevMode/Test/AbstractCase.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
* @license http://github.com/sourcerer-mike/magento-snippets/blob/master/License.md BSD 3-Clause ("BSD New")
2626
* @link http://github.com/sourcerer-mike/magento-snippets
2727
* @since 0.1.0
28+
*
29+
* @loadFixture default
2830
*/
2931
abstract class LeMike_DevMode_Test_AbstractCase extends EcomDev_PHPUnit_Test_Case
3032
{
@@ -49,4 +51,15 @@ public function testSelf()
4951
public function testBlackbox()
5052
{
5153
}
54+
55+
56+
public function callMethod($object, $method, $args = array())
57+
{
58+
$reflect = new ReflectionObject($object);
59+
60+
$reflectMethod = $reflect->getMethod($method);
61+
$reflectMethod->setAccessible(true);
62+
63+
return $reflectMethod->invokeArgs($object, $args);
64+
}
5265
}

app/code/community/LeMike/DevMode/Test/Helper/ConfigTest.php

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,58 @@
2828
*/
2929
class LeMike_DevMail_Test_Helper_ConfigTest extends LeMike_DevMode_Test_AbstractCase
3030
{
31+
/**
32+
* Get config helper.
33+
*
34+
* @return LeMike_DevMode_Helper_Config
35+
*/
3136
public function getFrontend()
3237
{
3338
return Mage::helper($this->_extensionNode . '/config');
3439
}
3540

3641

42+
public function testSelf()
43+
{
44+
$this->assertInstanceOf('LeMike_DevMode_Helper_Config', $this->getFrontend());
45+
}
46+
47+
3748
/**
38-
* Tests IsMailAllowed.
49+
* .
3950
*
40-
* @return null
51+
* @return void
4152
*/
4253
public function testIsMailAllowed()
4354
{
44-
$now = $this->getFrontend()->isMailAllowed();
55+
$helper = $this->getFrontend();
56+
$this->assertTrue(method_exists($helper, 'isMailAllowed'));
57+
$helper->isMailAllowed();
58+
}
4559

46-
var_dump($this->getModuleNameFromCallStack());
4760

48-
return null;
61+
/**
62+
* .
63+
*
64+
* @return void
65+
*/
66+
public function testGetCoreEmailRecipient()
67+
{
68+
$helper = $this->getFrontend();
69+
$this->assertTrue(method_exists($helper, 'getCoreEmailRecipient'));
70+
$helper->getCoreEmailRecipient();
71+
}
72+
73+
74+
/**
75+
* .
76+
*
77+
* @return void
78+
*/
79+
public function testGetCustomerCustomerPassword()
80+
{
81+
$helper = $this->getFrontend();
82+
$this->assertTrue(method_exists($helper, 'getCustomerCustomerPassword'));
83+
$helper->getCustomerCustomerPassword();
4984
}
5085
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?php
2+
/**
3+
* Contains class.
4+
*
5+
* PHP version 5
6+
*
7+
* Copyright (c) 2013, Mike Pretzlaw
8+
* All rights reserved.
9+
*
10+
* @category mage_devMail
11+
* @package DataTest.php
12+
* @author Mike Pretzlaw <[email protected]>
13+
* @copyright 2013 Mike Pretzlaw
14+
* @license http://github.com/sourcerer-mike/mage_devMail/blob/master/License.md BSD 3-Clause ("BSD New")
15+
* @link http://github.com/sourcerer-mike/mage_devMail
16+
* @since $VERSION$
17+
*/
18+
19+
/**
20+
* Class DataTest.
21+
*
22+
* @category mage_devMail
23+
* @author Mike Pretzlaw <[email protected]>
24+
* @copyright 2013 Mike Pretzlaw
25+
* @license http://github.com/sourcerer-mike/mage_devMail/blob/master/License.md BSD 3-Clause ("BSD New")
26+
* @link http://github.com/sourcerer-mike/mage_devMail
27+
* @since $VERSION$
28+
*/
29+
class LeMike_DevMode_Test_Helper_DataTest extends LeMike_DevMode_Test_AbstractCase
30+
{
31+
/**
32+
* .
33+
*
34+
* @return LeMike_DevMode_Helper_Data
35+
*/
36+
public function getFrontend()
37+
{
38+
return Mage::helper($this->_extensionNode);
39+
}
40+
41+
42+
/**
43+
* Tests GetStore.
44+
*
45+
* @return null
46+
*/
47+
public function testGetStore()
48+
{
49+
$helper = $this->getFrontend();
50+
51+
$this->assertNotNull($this->callMethod($helper, '_getStoreId'));
52+
53+
return null;
54+
}
55+
56+
57+
/**
58+
* Tests GetStoreConfig.
59+
*
60+
* @return null
61+
*/
62+
public function testGetStoreConfig()
63+
{
64+
$helper = $this->getFrontend();
65+
66+
$configPath = 'web/unsecure/base_url';
67+
$this->assertNotNull(
68+
$this->callMethod($helper, '_getStoreConfig', array($configPath))
69+
);
70+
71+
$this->assertNotNull($helper->getStoreConfig($configPath));
72+
73+
return null;
74+
}
75+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
/**
3+
* Contains class.
4+
*
5+
* PHP version 5
6+
*
7+
* Copyright (c) 2013, Mike Pretzlaw
8+
* All rights reserved.
9+
*
10+
* @category mage_devMail
11+
* @package EmailTest.php
12+
* @author Mike Pretzlaw <[email protected]>
13+
* @copyright 2013 Mike Pretzlaw
14+
* @license http://github.com/sourcerer-mike/mage_devMail/blob/master/License.md BSD 3-Clause ("BSD New")
15+
* @link http://github.com/sourcerer-mike/mage_devMail
16+
* @since $VERSION$
17+
*/
18+
19+
/**
20+
* Class LeMike_DevMode_Test_Model_EmailTest.
21+
*
22+
* @category ${PROJECT_NAME}
23+
* @author Mike Pretzlaw <[email protected]>
24+
* @copyright ${YEAR} Mike Pretzlaw
25+
* @license http://github.com/sourcerer-mike/${PROJECT_NAME}/blob/master/License.md BSD 3-Clause ("BSD New")
26+
* @link http://github.com/sourcerer-mike/${PROJECT_NAME}
27+
* @since ${DS}VERSION${DS}
28+
*
29+
* @loadFixture default
30+
*/
31+
class LeMike_DevMode_Test_Model_EmailTest extends LeMike_DevMode_Test_AbstractCase
32+
{
33+
/**
34+
* .
35+
*
36+
* @return LeMike_DevMode_Model_Core_Email|Mage_Core_Model_Email
37+
*/
38+
public function getFrontend()
39+
{
40+
return Mage::getModel('core/email');
41+
}
42+
43+
44+
public function testRewrite()
45+
{
46+
$model = $this->getFrontend();
47+
48+
$this->assertInstanceOf('LeMike_DevMode_Model_Core_Email', $model);
49+
}
50+
51+
52+
/**
53+
* Test fixture configuration.
54+
*
55+
* @return void
56+
*/
57+
public function testFixtureConfig()
58+
{
59+
$this->assertFalse(Mage::helper('lemike_devmode/config')->isMailAllowed());
60+
}
61+
62+
63+
public function testSend()
64+
{
65+
$model = $this->getFrontend();
66+
$model->setBody('foo');
67+
68+
var_dump($model->send());
69+
exit;
70+
}
71+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
config:
2+
lemike_devmode_core/email/active: 1
3+
lemike_devmode_core/email/recipient: 0

app/etc/modules/LeMike_DevMode.xml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* This file is part of the FIREGENTO project.
5-
*
6-
* FireGento_GermanSetup is free software; you can redistribute it and/or
7-
* modify it under the terms of the GNU General Public License version 3 as
8-
* published by the Free Software Foundation.
9-
*
10-
* This script is distributed in the hope that it will be useful, but WITHOUT
11-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12-
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
4+
* Contains module XML.
135
*
146
* PHP version 5
157
*
16-
* @category FireGento
17-
* @package FireGento_GermanSetup
18-
* @author FireGento Team <[email protected]>
19-
* @copyright 2012 FireGento Team (http://www.firegento.de). All rights served.
20-
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
21-
* @version $Id:$
22-
* @since 0.1.0
8+
* Copyright (c) 2013, Mike Pretzlaw
9+
* All rights reserved.
10+
*
11+
* @category magento-snippets
12+
* @package AbstractTest.php
13+
* @author Mike Pretzlaw <[email protected]>
14+
* @copyright 2013 Mike Pretzlaw
15+
* @license http://github.com/sourcerer-mike/magento-snippets/blob/master/License.md BSD 3-Clause ("BSD New")
16+
* @link http://github.com/sourcerer-mike/magento-snippets
17+
* @since 0.1.0
2318
*/
2419
-->
2520
<config>

0 commit comments

Comments
 (0)