Here is the test suite for my Agg plugin.
class ModelsTest extends CakeTestSuite
{
public static function suite()
{
$suite = new CakeTestSuite('All the models');
$suite->addTestDirectory(TESTS . 'Case' . DS . 'Model');
return $suite;
}
}
I've looked at the test cases from the Cake core. I can't see anything that
I did wrong.
Also, I've gone threw GIT for both CakePHP and PHPUnit. Nothing has changed
that would have introduced this.
So it has to be a problem with how I'm running the tests.
On Thursday, 17 January 2013 13:37:36 UTC-5, Mathew wrote:
>
> Hi,
>
> I'm unable to run a CakeTestSuite, but I can run a CakeTestCase just fine
> on the CLI.
>
> When I run the CakeTestSuite I get the following error.
>
> Warning: is_file() expects parameter 1 to be string, array given in
> C:\Program Files (x86)\PHP\PEAR\PHPUnit\Util\Skeleton\Test.php on line 109
>
> Call Stack:
> 0.0004 335536 1. {main}()
> C:\work\zend\cake\Cake\Console\cake.php:0
> 0.0049 452272 2. ShellDispatcher::run($argv = array (0 =>
> 'C:\\work\\zend\\cake\\Cake\\Console\\cake.php', 1 => '-working', 2 =>
> 'C:\\work\\zend\\cgtag\\cgtag\\app ', 3 =
> > 'test', 4 => 'agg', 5 => 'Models'))
> C:\work\zend\cake\Cake\Console\cake.php:43
> 0.1724 2600904 3. ShellDispatcher->dispatch()
> C:\work\zend\cake\Cake\Console\ShellDispatcher.php:69
> 0.2364 3349648 4. Shell->runCommand($command = 'agg', $argv =
> array (0 => 'agg', 1 => 'Models'))
> C:\work\zend\cake\Cake\Console\ShellDispatcher.php:201
> 0.2998 4215400 5. TestShell->main()
> C:\work\zend\cake\Cake\Console\Shell.php:395
> 0.3002 4216112 6. TestShell->_run($runnerArgs = array ('core' =>
> FALSE, 'app' => FALSE, 'plugin' => 'agg', 'output' => 'text', 'case' =>
> 'Models'), $options = array (0 =>
> '--colors')) C:\work\zend\cake\Cake\Console\Command\TestShell.php:259
> 0.3169 4540880 7. CakeTestSuiteCommand->run($argv = array (0 =>
> '--colors'), $exit = ???)
> C:\work\zend\cake\Cake\Console\Command\TestShell.php:274
> 0.3960 6485384 8.
> PHPUnit_Util_Skeleton_Test->__construct($inClassName = 'All model tests',
> $inSourceFile = array ('core' => FALSE, 'app' => FALSE, 'plugin' => 'agg',
> 'out
> put' => 'text', 'case' => 'Models'), $outClassName = ???, $outSourceFile =
> ???) C:\work\zend\cake\Cake\TestSuite\CakeTestSuiteCommand.php:80
> 0.3962 6485512 9. is_file(array ('core' => FALSE, 'app' => FALSE,
> 'plugin' => 'agg', 'output' => 'text', 'case' => 'Models')) C:\Program
> Files (x86)\PHP\PEAR\PHPUnit\Util\
> Skeleton\Test.php:109
>
>
> Variables in local scope (#8):
> $inClassName = 'All model tests'
> $inSourceFile = array ('core' => FALSE, 'app' => FALSE, 'plugin' =>
> 'agg', 'output' => 'text', 'case' => 'Models')
> $outClassName = ''
> $outSourceFile = ''
> $possibleFilename = *uninitialized*
> $possibleFilenames = *uninitialized*
> $reflector = *uninitialized*
>
> Error: "Array" could not be opened.
> #0 C:\work\zend\cake\Cake\TestSuite\CakeTestSuiteCommand.php(80):
> PHPUnit_Util_Skeleton_Test->__construct('All model tests', Array)
> #1 C:\work\zend\cake\Cake\Console\Command\TestShell.php(274):
> CakeTestSuiteCommand->run(Array)
> #2 C:\work\zend\cake\Cake\Console\Command\TestShell.php(259):
> TestShell->_run(Array, Array)
> #3 C:\work\zend\cake\Cake\Console\Shell.php(395): TestShell->main()
> #4 C:\work\zend\cake\Cake\Console\ShellDispatcher.php(201):
> Shell->runCommand('agg', Array)
> #5 C:\work\zend\cake\Cake\Console\ShellDispatcher.php(69):
> ShellDispatcher->dispatch()
> #6 C:\work\zend\cake\Cake\Console\cake.php(43): ShellDispatcher::run(Array)
> #7 {main}
>
> --------------------------
>
> Now I ran this under the debugger and found that the problem appears to be
> in CakeTestSuiteCommand on line 77.
>
> $skeleton = new PHPUnit_Util_Skeleton_Test(
> $suite->getName(),
> $this->arguments['testFile']
> );
>
> PHPUnit_Util_Skeleton_Test is expecting the second parameter to be a
> string, but Cake is using an array.
>
> Here's what the array holds.
>
> $this->arguments['testFile'] = array(
> 'core'=>false,
> 'app'=>false,
> 'plugin'=>'agg',
> 'output'=>'text',
> 'case'=>'Models'
> )
>
> I don't know what to do to fix this. Is this a bug in Cake, or am I not
> configuring the test correctly.
>
> I also tried to run this Suite via the Web but get the same error message.
>
> Please help.
>
>
>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.