@@ 36-97 (lines=62) @@ | ||
33 | * |
|
34 | * @author MageTest team (https://github.com/MageTest/MageSpec/contributors) |
|
35 | */ |
|
36 | class BlockGenerator extends MagentoObjectGenerator implements GeneratorInterface |
|
37 | { |
|
38 | /** |
|
39 | * @param ResourceInterface $resource |
|
40 | * @param string $generation |
|
41 | * @param array $data |
|
42 | * @return bool |
|
43 | */ |
|
44 | public function supports(ResourceInterface $resource, $generation, array $data) |
|
45 | { |
|
46 | return 'class' === $generation && $resource instanceof BlockResource; |
|
47 | } |
|
48 | ||
49 | /** |
|
50 | * @return int |
|
51 | */ |
|
52 | public function getPriority() |
|
53 | { |
|
54 | return 30; |
|
55 | } |
|
56 | ||
57 | /** |
|
58 | * @param ResourceInterface $resource |
|
59 | * |
|
60 | * @return string |
|
61 | */ |
|
62 | protected function getFilePath(ResourceInterface $resource) |
|
63 | { |
|
64 | return $resource->getSrcFilename(); |
|
65 | } |
|
66 | ||
67 | /** |
|
68 | * @param ResourceInterface $resource |
|
69 | * @param string $filepath |
|
70 | * |
|
71 | * @return string |
|
72 | */ |
|
73 | protected function getGeneratedMessage(ResourceInterface $resource, $filepath) |
|
74 | { |
|
75 | return sprintf( |
|
76 | "<info>Magento block <value>%s</value> created in <value>'%s'</value>.</info>\n", |
|
77 | $resource->getSrcClassname(), |
|
78 | $filepath |
|
79 | ); |
|
80 | } |
|
81 | ||
82 | /** |
|
83 | * @return string |
|
84 | */ |
|
85 | protected function getParentClass() |
|
86 | { |
|
87 | return 'Mage_Core_Block_Abstract'; |
|
88 | } |
|
89 | ||
90 | /** |
|
91 | * @return string |
|
92 | */ |
|
93 | protected function getTemplateName() |
|
94 | { |
|
95 | return 'mage_block'; |
|
96 | } |
|
97 | } |
|
98 |
@@ 35-96 (lines=62) @@ | ||
32 | * |
|
33 | * @author MageTest team (https://github.com/MageTest/MageSpec/contributors) |
|
34 | */ |
|
35 | class ControllerGenerator extends MagentoObjectGenerator implements GeneratorInterface |
|
36 | { |
|
37 | /** |
|
38 | * @param ResourceInterface $resource |
|
39 | * @param string $generation |
|
40 | * @param array $data |
|
41 | * @return bool |
|
42 | */ |
|
43 | public function supports(ResourceInterface $resource, $generation, array $data) |
|
44 | { |
|
45 | return 'class' === $generation && $resource instanceof ControllerResource; |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * @return int |
|
50 | */ |
|
51 | public function getPriority() |
|
52 | { |
|
53 | return 10; |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * @param ResourceInterface $resource |
|
58 | * |
|
59 | * @return string |
|
60 | */ |
|
61 | protected function getFilePath(ResourceInterface $resource) |
|
62 | { |
|
63 | return $resource->getSrcFilename(); |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * @param ResourceInterface $resource |
|
68 | * @param string $filepath |
|
69 | * |
|
70 | * @return string |
|
71 | */ |
|
72 | protected function getGeneratedMessage(ResourceInterface $resource, $filepath) |
|
73 | { |
|
74 | return sprintf( |
|
75 | "<info>Magento controller <value>%s</value> created in <value>'%s'</value>.</info>\n", |
|
76 | $resource->getSrcClassname(), |
|
77 | $filepath |
|
78 | ); |
|
79 | } |
|
80 | ||
81 | /** |
|
82 | * @return string |
|
83 | */ |
|
84 | protected function getParentClass() |
|
85 | { |
|
86 | return 'Mage_Core_Controller_Front_Action'; |
|
87 | } |
|
88 | ||
89 | /** |
|
90 | * @return string |
|
91 | */ |
|
92 | protected function getTemplateName() |
|
93 | { |
|
94 | return 'mage_controller'; |
|
95 | } |
|
96 | } |
|
97 |
@@ 35-96 (lines=62) @@ | ||
32 | * |
|
33 | * @author MageTest team (https://github.com/MageTest/MageSpec/contributors) |
|
34 | */ |
|
35 | class HelperGenerator extends MagentoObjectGenerator implements GeneratorInterface |
|
36 | { |
|
37 | /** |
|
38 | * @param ResourceInterface $resource |
|
39 | * @param string $generation |
|
40 | * @param array $data |
|
41 | * @return bool |
|
42 | */ |
|
43 | public function supports(ResourceInterface $resource, $generation, array $data) |
|
44 | { |
|
45 | return 'class' === $generation && $resource instanceof HelperResource; |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * @return int |
|
50 | */ |
|
51 | public function getPriority() |
|
52 | { |
|
53 | return 20; |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * @param ResourceInterface $resource |
|
58 | * |
|
59 | * @return string |
|
60 | */ |
|
61 | protected function getFilePath(ResourceInterface $resource) |
|
62 | { |
|
63 | return $resource->getSrcFilename(); |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * @param ResourceInterface $resource |
|
68 | * @param string $filepath |
|
69 | * |
|
70 | * @return string |
|
71 | */ |
|
72 | protected function getGeneratedMessage(ResourceInterface $resource, $filepath) |
|
73 | { |
|
74 | return sprintf( |
|
75 | "<info>Magento helper <value>%s</value> created in <value>'%s'</value>.</info>\n", |
|
76 | $resource->getSrcClassname(), |
|
77 | $filepath |
|
78 | ); |
|
79 | } |
|
80 | ||
81 | /** |
|
82 | * @return string |
|
83 | */ |
|
84 | protected function getParentClass() |
|
85 | { |
|
86 | return 'Mage_Core_Helper_Abstract'; |
|
87 | } |
|
88 | ||
89 | /** |
|
90 | * @return string |
|
91 | */ |
|
92 | protected function getTemplateName() |
|
93 | { |
|
94 | return 'mage_helper'; |
|
95 | } |
|
96 | } |
|
97 |
@@ 35-96 (lines=62) @@ | ||
32 | * |
|
33 | * @author MageTest team (https://github.com/MageTest/MageSpec/contributors) |
|
34 | */ |
|
35 | class ModelGenerator extends MagentoObjectGenerator implements GeneratorInterface |
|
36 | { |
|
37 | /** |
|
38 | * @param ResourceInterface $resource |
|
39 | * @param string $generation |
|
40 | * @param array $data |
|
41 | * @return bool |
|
42 | */ |
|
43 | public function supports(ResourceInterface $resource, $generation, array $data) |
|
44 | { |
|
45 | return 'class' === $generation && $resource instanceof ModelResource; |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * @return int |
|
50 | */ |
|
51 | public function getPriority() |
|
52 | { |
|
53 | return 42; |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * @param ResourceInterface $resource |
|
58 | * |
|
59 | * @return string |
|
60 | */ |
|
61 | protected function getFilePath(ResourceInterface $resource) |
|
62 | { |
|
63 | return $resource->getSrcFilename(); |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * @param ResourceInterface $resource |
|
68 | * @param string $filepath |
|
69 | * |
|
70 | * @return string |
|
71 | */ |
|
72 | protected function getGeneratedMessage(ResourceInterface $resource, $filepath) |
|
73 | { |
|
74 | return sprintf( |
|
75 | "<info>Magento model <value>%s</value> created in <value>'%s'</value>.</info>\n", |
|
76 | $resource->getSrcClassname(), |
|
77 | $filepath |
|
78 | ); |
|
79 | } |
|
80 | ||
81 | /** |
|
82 | * @return string |
|
83 | */ |
|
84 | protected function getParentClass() |
|
85 | { |
|
86 | return 'Mage_Core_Model_Abstract'; |
|
87 | } |
|
88 | ||
89 | /** |
|
90 | * @return string |
|
91 | */ |
|
92 | protected function getTemplateName() |
|
93 | { |
|
94 | return 'mage_model'; |
|
95 | } |
|
96 | } |
|
97 |