Skip to content

Instantly share code, notes, and snippets.

@mariuskubilius
Last active August 29, 2015 13:57
Show Gist options
  • Save mariuskubilius/9913269 to your computer and use it in GitHub Desktop.
Save mariuskubilius/9913269 to your computer and use it in GitHub Desktop.
Li3 tests throwing exception in tests->affected
<?php
namespace app\models;
class TimeSlots extends \lithium\data\Model {
protected $_schema = array(
'id' => array('type' => 'id', 'null' => false),
'time_from' => array('type' => 'time', 'null' => false),
'time_to' => array('type' => 'time', 'null' => false),
'weekday_from' => array('type' => 'int', 'null' => false),
'weekday_to' => array('type' => 'int', 'null' => false)
);
public $validates = array();
}
?>
<?php
namespace app\tests\mocks\models;
class MockTimeSlots extends \app\models\TimeSlots {
protected $_meta = array('connection' => false);
}
?>
<?php
namespace app\tests\cases\models;
use app\models\TimeSlots;
use app\tests\mocks\models\MockTimeSlots;
class TimeSlotsTest extends \lithium\test\Unit {
public function setUp() {}
public function tearDown() {}
public function testTimeSlotsHasFields() {
$this->assertEqual('id', MockTimeSlots::hasField('id')['type']);
$this->assertEqual('time', MockTimeSlots::hasField('time_from')['type']);
$this->assertEqual('time', MockTimeSlots::hasField('time_to')['type']);
$this->assertEqual('int', MockTimeSlots::hasField('weekday_from')['type']);
$this->assertEqual('int', MockTimeSlots::hasField('weekday_to')['type']);
}
}
?>
! ) Notice: Use of undefined constant type - assumed 'type' in /Applications/mampstack-5.4.17-0/apache2/htdocs/libraries/lithium/analysis/Inspector.php on line 543
Call Stack
# Time Memory Function Location
1 0.0000 239680 {main}( ) ../index.php:0
2 0.0093 1652672 lithium\action\Dispatcher::run( ) ../index.php:41
3 0.0094 1654448 lithium\core\StaticObject::_filter( ) ../Dispatcher.php:155
4 0.0094 1657264 lithium\util\collection\Filters::run( ) ../StaticObject.php:147
5 0.0094 1660208 lithium\core\Libraries::{closure:/Applications/mampstack-5.4.17-0/apache2/htdocs/libraries/li3_docs/config/bootstrap.php:26-38}( ) ../Filters.php:184
6 0.0097 1690304 lithium\util\collection\Filters->next( ) ../bootstrap.php:32
7 0.0097 1690464 {closure:/Applications/mampstack-5.4.17-0/apache2/htdocs/app/config/bootstrap/action.php:41-52}( ) ../Filters.php:203
8 0.0129 1791400 lithium\util\collection\Filters->next( ) ../action.php:51
9 0.0129 1791448 {closure:/Applications/mampstack-5.4.17-0/apache2/htdocs/app/config/bootstrap/cache.php:41-57}( ) ../Filters.php:203
10 0.0129 1791624 lithium\util\collection\Filters->next( ) ../cache.php:43
11 0.0129 1791672 lithium\action\Dispatcher::lithium\action\{closure}( ) ../Filters.php:203
12 0.0137 1811416 lithium\core\StaticObject::invokeMethod( ) ../Dispatcher.php:154
13 0.0137 1811464 lithium\action\Dispatcher::_call( ) ../StaticObject.php:85
14 0.0137 1813232 lithium\core\StaticObject::_filter( ) ../Dispatcher.php:265
15 0.0137 1813560 lithium\action\Dispatcher::lithium\action\{closure}( ) ../StaticObject.php:140
16 0.0138 1813592 lithium\test\Controller->__invoke( ) ../Dispatcher.php:262
17 0.0138 1817984 lithium\core\Object->_filter( ) ../Controller.php:72
18 0.0138 1818448 lithium\test\Controller->lithium\test\{closure}( ) ../Object.php:259
19 0.0141 1851120 lithium\test\Dispatcher::run( ) ../Controller.php:60
20 0.0150 2029152 lithium\core\StaticObject::_filter( ) ../Dispatcher.php:73
21 0.0150 2029632 lithium\test\Dispatcher::lithium\test\{closure}( ) ../StaticObject.php:140
22 0.0150 2029760 lithium\test\Report->run( ) ../Dispatcher.php:69
23 0.0153 2062672 lithium\test\filter\Affected::apply( ) ../Report.php:142
24 0.0154 2063872 lithium\test\filter\Affected::_affected( ) ../Affected.php:42
25 0.7984 5388936 lithium\analysis\Inspector::dependencies( ) ../Affected.php:92
26 0.8147 5391736 lithium\analysis\Inspector::info( ) ../Inspector.php:515
27 0.8149 5444480 lithium\analysis\Inspector::_class( ) ../Inspector.php:160
28 0.8149 5444832 unserialize ( ) ../Inspector.php:543
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment