Browse files

creating the new task tests and starting with the easy ones

  • Loading branch information...
1 parent 4812f86 commit 7db2138a9e4be30bb31e1517e848747e71f484ae @Zeelot Zeelot committed Mar 6, 2012
Showing with 70 additions and 143 deletions.
  1. +70 −0 tests/minion/task.php
  2. +0 −143 tests/minion/util.php
View
70 tests/minion/task.php
@@ -0,0 +1,70 @@
+<?php
+
+/**
+ * Test case for Minion_Util
+ *
+ * @package Kohana/Minion
+ * @group kohana
+ * @group kohana.minion
+ * @category Test
+ * @author Kohana Team
+ * @copyright (c) 2009-2012 Kohana Team
+ * @license http://kohanaframework.org/license
+ */
+
+class Minion_TaskTest extends Kohana_Unittest_TestCase
+{
+ /**
+ * Provides test data for test_convert_task_to_class_name()
+ *
+ * @return array
+ */
+ public function provider_convert_task_to_class_name()
+ {
+ return array(
+ array('Task_Db_Migrate', 'db:migrate'),
+ array('Task_Db_Status', 'db:status'),
+ array('', ''),
+ );
+ }
+
+ /**
+ * Tests that a task can be converted to a class name
+ *
+ * @test
+ * @covers Minion_Util::convert_task_to_class_name
+ * @dataProvider provider_convert_task_to_class_name
+ * @param string Expected class name
+ * @param string Input task name
+ */
+ public function test_convert_task_to_class_name($expected, $task_name)
+ {
+ $this->assertSame($expected, Minion_Task::convert_task_to_class_name($task_name));
+ }
+
+ /**
+ * Provides test data for test_convert_class_to_task()
+ *
+ * @return array
+ */
+ public function provider_convert_class_to_task()
+ {
+ return array(
+ array('db:migrate', 'Task_Db_Migrate'),
+ );
+ }
+
+ /**
+ * Tests that the task name can be found from a class name / object
+ *
+ * @test
+ * @covers Minion_Util::convert_class_to_task
+ * @dataProvider provider_convert_class_to_task
+ * @param string Expected task name
+ * @param mixed Input class
+ */
+ public function test_convert_class_to_task($expected, $class)
+ {
+ $this->assertSame($expected, Minion_Task::convert_class_to_task($class));
+ }
+}
View
143 tests/minion/util.php
@@ -1,143 +0,0 @@
-<?php
-
-/**
- * Test case for Minion_Util
- *
- * @package Kohana/Minion
- * @group kohana
- * @group kohana.minion
- * @category Test
- * @author Kohana Team
- * @copyright (c) 2009-2012 Kohana Team
- * @license http://kohanaframework.org/license
- */
-
-class Minion_UtilTest extends Kohana_Unittest_TestCase
-{
- /**
- * Provides test data for test_parse_doccoment()
- *
- * @return array Test data
- */
- public function provider_parse_doccoment()
- {
- return array(
- array(
- array(
- "This is my comment from something or\nother",
- array(
- 'author' => 'Matt Button <matthew@sigswitch.com>',
- ),
- ),
- " /**\n * This is my comment from something or\n * other\n * \n * @author Matt Button <matthew@sigswitch.com>\n */",
- ),
- );
- }
-
- /**
- * Tests Minion_Util::prase_doccoment
- *
- * @test
- * @dataProvider provider_parse_doccoment
- * @covers Minion_Util::parse_doccomment
- * @param array Expected output
- * @param string Input doccoment
- */
- public function test_parse_doccoment($expected, $doccomment)
- {
- $this->assertSame($expected, Minion_Util::parse_doccomment($doccomment));
- }
-
- /**
- * Provides test data for test_compile_task_list()
- *
- * @return array Test data
- */
- public function provider_compile_task_list()
- {
- return array(
- array(
- array(
- 'db:migrate',
- 'db:status',
- ),
- array (
- 'classes/task/db' => array (
- 'classes/task/db/migrate.php' => '/var/www/memberful/memberful-core/modules/kohana-minion/classes/task/db/migrate.php',
- 'classes/task/db/status.php' => '/var/www/memberful/memberful-core/modules/kohana-minion/classes/task/db/status.php',
- ),
- ),
- ),
- );
- }
-
- /**
- * Tests that compile_task_list accurately creates a list of tasks from a directory structure
- *
- * @test
- * @covers Minion_Util::compile_task_list
- * @dataProvider provider_compile_task_list
- * @param array Expected output
- * @param array List of files
- * @param string Prefix to use
- * @param string Separator to use
- */
- public function test_compile_task_list($expected, $files, $prefix = '', $separator = ':')
- {
- $this->assertSame($expected, Minion_Util::compile_task_list($files, $prefix, $separator));
- }
-
- /**
- * Provides test data for test_convert_task_to_class_name()
- *
- * @return array
- */
- public function provider_convert_task_to_class_name()
- {
- return array(
- array('Task_Db_Migrate', 'db:migrate'),
- array('Task_Db_Status', 'db:status'),
- array('', ''),
- );
- }
-
- /**
- * Tests that a task can be converted to a class name
- *
- * @test
- * @covers Minion_Util::convert_task_to_class_name
- * @dataProvider provider_convert_task_to_class_name
- * @param string Expected class name
- * @param string Input task name
- */
- public function test_convert_task_to_class_name($expected, $task_name)
- {
- $this->assertSame($expected, Minion_Util::convert_task_to_class_name($task_name));
- }
-
- /**
- * Provides test data for test_convert_class_to_task()
- *
- * @return array
- */
- public function provider_convert_class_to_task()
- {
- return array(
- array('db:migrate', 'Task_Db_Migrate'),
- );
- }
-
- /**
- * Tests that the task name can be found from a class name / object
- *
- * @test
- * @covers Minion_Util::convert_class_to_task
- * @dataProvider provider_convert_class_to_task
- * @param string Expected task name
- * @param mixed Input class
- */
- public function test_convert_class_to_task($expected, $class)
- {
- $this->assertSame($expected, Minion_Util::convert_class_to_task($class));
- }
-}

0 comments on commit 7db2138

Please sign in to comment.