How to use getLocale method of asserter class

Best Atoum code snippet using asserter.getLocale

mock.php

Source:mock.php Github

copy

Full Screen

...25 {26 $this27 ->if($asserter = new sut($generator = new asserter\generator()))28 ->then29 ->object($asserter->getLocale())->isIdenticalTo($generator->getLocale())30 ->object($asserter->getGenerator())->isIdenticalTo($generator)31 ->variable($asserter->getAdapter())->isNull()32 ->variable($asserter->getCall())->isEqualTo(new test\adapter\call())33 ;34 }35 public function testReset()36 {37 $this38 ->if($mockController = new \mock\mageekguy\atoum\mock\controller())39 ->and($asserter = new sut($generator = new asserter\generator()))40 ->then41 ->variable($asserter->getAdapter())->isNull()42 ->object($asserter->reset())->isIdenticalTo($asserter)43 ->variable($asserter->getAdapter())->isNull()44 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\score()))45 ->and($mock->setMockController($mockController))46 ->and($this->resetMock($mockController))47 ->then48 ->object($asserter->getAdapter())->isIdenticalTo($mock->getMockController())49 ->object($asserter->reset())->isIdenticalTo($asserter)50 ->object($asserter->getAdapter())->isIdenticalTo($mock->getMockController())51 ->mock($mockController)->call('resetCalls')->once();52 }53 public function testSetWith()54 {55 $this56 ->if($asserter = new sut($generator = new asserter\generator()))57 ->and($adapter = new atoum\test\adapter())58 ->and($adapter->class_exists = true)59 ->then60 ->exception(function() use ($asserter, & $mock) { $asserter->setWith($mock = uniqid()); })61 ->isInstanceOf('mageekguy\atoum\asserter\exception')62 ->hasMessage(sprintf($generator->getLocale()->_('%s is not a mock'), $asserter->getTypeOf($mock)))63 ->object($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\mock($adapter)))->isIdenticalTo($asserter)64 ->object($asserter->getAdapter())->isIdenticalTo($mock->getMockController())65 ;66 }67 public function testWasCalled()68 {69 $this70 ->if($asserter = new sut($generator = new asserter\generator()))71 ->then72 ->exception(function() use ($asserter) { $asserter->wasCalled(); })73 ->isInstanceOf('mageekguy\atoum\exceptions\logic')74 ->hasMessage('Mock is undefined')75 ->if($adapter = new atoum\test\adapter())76 ->and($adapter->class_exists = true)77 ->and($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\mock($adapter)))78 ->and($mock->getMockController()->resetCalls())79 ->then80 ->exception(function() use ($asserter) { $asserter->wasCalled(); })81 ->isInstanceOf('mageekguy\atoum\asserter\exception')82 ->hasMessage(sprintf($generator->getLocale()->_('%s is not called'), get_class($mock)))83 ->exception(function() use ($asserter, & $failMessage) { $asserter->wasCalled($failMessage = uniqid()); })84 ->isInstanceOf('mageekguy\atoum\asserter\exception')85 ->hasMessage($failMessage)86 ->if($mock->getMockController()->{$method = __FUNCTION__} = function() {})87 ->and($mock->{$method}())88 ->then89 ->object($asserter->wasCalled())->isIdenticalTo($asserter)90 ;91 }92 public function testWasNotCalled()93 {94 $this95 ->if($asserter = new sut($generator = new asserter\generator()))96 ->then97 ->exception(function() use ($asserter) { $asserter->wasNotCalled(); })98 ->isInstanceOf('mageekguy\atoum\exceptions\logic')99 ->hasMessage('Mock is undefined')100 ->if($adapter = new atoum\test\adapter())101 ->and($adapter->class_exists = true)102 ->and($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\mock($adapter)))103 ->and($mock->getMockController()->resetCalls())104 ->then105 ->object($asserter->wasNotCalled())->isIdenticalTo($asserter)106 ->if($mock->getMockController()->{$method = __FUNCTION__} = function() {})107 ->and($mock->{$method}())108 ->then109 ->exception(function() use ($asserter, & $failMessage) { $asserter->wasNotCalled($failMessage = uniqid()); })110 ->isInstanceOf('mageekguy\atoum\asserter\exception')111 ->hasMessage($failMessage)112 ;113 }114 public function testCall()115 {116 $this117 ->mockGenerator->orphanize('asserterFail')118 ->if($asserter = new sut(new \mock\mageekguy\atoum\asserter\generator()))119 ->then120 ->exception(function() use ($asserter) { $asserter->call(uniqid()); })121 ->isInstanceOf('mageekguy\atoum\exceptions\logic')122 ->hasMessage('Mock is undefined')123 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))124 ->then125 ->object($asserter->call($function = uniqid()))->isIdenticalTo($asserter)126 ->object($asserter->getCall())->isEqualTo(new test\adapter\call($function, null, new decorators\addClass($mock->getMockController()->getMockClass())))127 ->if($asserter->withArguments())128 ->then129 ->object($asserter->getCall())->isEqualTo(new test\adapter\call($function, array(), new decorators\addClass($mock->getMockController()->getMockClass())))130 ->object($asserter->disableEvaluationChecking()->call($function = uniqid()))->isIdenticalTo($asserter)131 ->object($asserter->getCall())->isEqualTo(new test\adapter\call($function, null, new decorators\addClass($mock->getMockController()->getMockClass())))132 ;133 }134 public function testWithArguments()135 {136 $this137 ->mockGenerator->orphanize('asserterFail')138 ->if($asserter = new sut(new \mock\mageekguy\atoum\asserter\generator()))139 ->then140 ->exception(function() use ($asserter) { $asserter->withArguments(uniqid()); })141 ->isInstanceOf('mageekguy\atoum\exceptions\logic')142 ->hasMessage('Mock is undefined')143 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))144 ->then145 ->exception(function() use ($asserter) { $asserter->withArguments(uniqid()); })146 ->isInstanceOf('mageekguy\atoum\exceptions\logic')147 ->hasMessage('Call is undefined')148 ->if($asserter->call($function = uniqid()))149 ->then150 ->object($asserter->withArguments())->isIdenticalTo($asserter)151 ->object($asserter->getCall())->isEqualTo(new test\adapter\call($function, array(), new decorators\addClass($mock)))152 ->object($asserter->withArguments($arg1 = uniqid()))->isIdenticalTo($asserter)153 ->object($asserter->getCall())->isEqualTo(new test\adapter\call($function, array($arg1), new decorators\addClass($mock)))154 ->object($asserter->disableEvaluationChecking()->withArguments($arg1 = uniqid(), $arg2 = uniqid()))->isIdenticalTo($asserter)155 ->object($asserter->getCall())->isEqualTo(new test\adapter\call($function, array($arg1, $arg2), new decorators\addClass($mock)))156 ;157 }158 public function testWithAtLeastArguments()159 {160 $this161 ->mockGenerator->orphanize('asserterFail')162 ->if($asserter = new sut(new \mock\mageekguy\atoum\asserter\generator()))163 ->then164 ->exception(function() use ($asserter) { $asserter->withArguments(uniqid()); })165 ->isInstanceOf('mageekguy\atoum\exceptions\logic')166 ->hasMessage('Mock is undefined')167 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))168 ->then169 ->exception(function() use ($asserter) { $asserter->withArguments(uniqid()); })170 ->isInstanceOf('mageekguy\atoum\exceptions\logic')171 ->hasMessage('Call is undefined')172 ->if($asserter->call($function = uniqid()))173 ->then174 ->object($asserter->withAtLeastArguments($arguments = array(1 => uniqid())))->isIdenticalTo($asserter)175 ->object($asserter->getCall())->isEqualTo(new test\adapter\call($function, $arguments, new decorators\addClass($mock)))176 ->object($asserter->disableEvaluationChecking()->withAtLeastArguments($arguments = array(2 => uniqid(), 5 => uniqid())))->isIdenticalTo($asserter)177 ->object($asserter->getCall())->isEqualTo(new test\adapter\call($function, $arguments, new decorators\addClass($mock)))178 ;179 }180 public function testWithAnyArguments()181 {182 $this183 ->mockGenerator->orphanize('asserterFail')184 ->if($asserter = new sut(new \mock\mageekguy\atoum\asserter\generator()))185 ->then186 ->exception(function() use ($asserter) { $asserter->withArguments(uniqid()); })187 ->isInstanceOf('mageekguy\atoum\exceptions\logic')188 ->hasMessage('Mock is undefined')189 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))190 ->then191 ->exception(function() use ($asserter) { $asserter->withArguments(uniqid()); })192 ->isInstanceOf('mageekguy\atoum\exceptions\logic')193 ->hasMessage('Call is undefined')194 ->if($asserter->call($function = uniqid()))195 ->then196 ->object($asserter->getCall())->isEqualTo(new test\adapter\call($function, null, new decorators\addClass($mock)))197 ->object($asserter->withAnyArguments())->isIdenticalTo($asserter)198 ->object($asserter->getCall())->isEqualTo(new test\adapter\call($function, null, new decorators\addClass($mock)))199 ->if($asserter->disableEvaluationChecking()->withArguments($arg = uniqid()))200 ->then201 ->object($asserter->getCall())->isEqualTo(new test\adapter\call($function, array($arg), new decorators\addClass($mock)))202 ->object($asserter->withAnyArguments())->isIdenticalTo($asserter)203 ->object($asserter->getCall())->isEqualTo(new test\adapter\call($function, null, new decorators\addClass($mock)))204 ;205 }206 public function testWithoutAnyArgument()207 {208 $this209 ->mockGenerator->orphanize('asserterFail')210 ->if($asserter = new sut(new \mock\mageekguy\atoum\asserter\generator()))211 ->then212 ->exception(function() use ($asserter) { $asserter->withoutAnyArgument(); })213 ->isInstanceOf('mageekguy\atoum\exceptions\logic')214 ->hasMessage('Mock is undefined')215 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))216 ->then217 ->exception(function() use ($asserter) { $asserter->withoutAnyArgument(); })218 ->isInstanceOf('mageekguy\atoum\exceptions\logic')219 ->hasMessage('Call is undefined')220 ->if($asserter->call($function = uniqid()))221 ->then222 ->object($asserter->disableEvaluationChecking()->withoutAnyArgument())->isIdenticalTo($asserter)223 ->object($asserter->getCall())->isEqualTo(new test\adapter\call($function, array(), new decorators\addClass($mock)))224 ;225 }226 public function testOnce()227 {228 $this229 ->if($asserter = new sut($generator = new asserter\generator()))230 ->then231 ->exception(function() use ($asserter) { $asserter->once(); })232 ->isInstanceOf('mageekguy\atoum\exceptions\logic')233 ->hasMessage('Mock is undefined')234 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))235 ->then236 ->exception(function() use ($asserter) { $asserter->once(); })237 ->isInstanceOf('mageekguy\atoum\exceptions\logic')238 ->hasMessage('Call is undefined')239 ->if($asserter->call('foo'))240 ->then241 ->exception(function() use ($asserter) { $asserter->once(); })242 ->isInstanceOf('mageekguy\atoum\asserter\exception')243 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 0 time instead of 1'), $asserter->getCall()))244 ->if($call = new test\adapter\call('foo', null, new decorators\addClass($mock->getMockController()->getMockClass())))245 ->and($call->setDecorator(new decorators\addClass($mock)))246 ->and($mock->foo($usedArg = uniqid()))247 ->then248 ->object($asserter->once())->isIdenticalTo($asserter)249 ->if($mock->foo($otherUsedArg = uniqid()))250 ->then251 ->exception(function() use ($asserter) { $asserter->once(); })252 ->isInstanceOf('mageekguy\atoum\asserter\exception')253 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 2 times instead of 1'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($otherUsedArg)))254 ->if($mock->getMockController()->resetCalls())255 ->and($asserter->withArguments($usedArg = uniqid()))256 ->and($mock->foo($usedArg))257 ->then258 ->object($asserter->once())->isIdenticalTo($asserter)259 ->if($asserter->withArguments($arg = uniqid()))260 ->then261 ->exception(function() use ($asserter) { $asserter->once(); })262 ->isInstanceOf('mageekguy\atoum\asserter\exception')263 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 0 time instead of 1'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))264 ;265 }266 public function testTwice()267 {268 $this269 ->if($asserter = new sut($generator = new asserter\generator()))270 ->then271 ->exception(function() use ($asserter) { $asserter->twice(); })272 ->isInstanceOf('mageekguy\atoum\exceptions\logic')273 ->hasMessage('Mock is undefined')274 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))275 ->then276 ->exception(function() use ($asserter) { $asserter->twice(); })277 ->isInstanceOf('mageekguy\atoum\exceptions\logic')278 ->hasMessage('Call is undefined')279 ->if($asserter->call('foo'))280 ->then281 ->exception(function() use ($asserter) { $asserter->twice(); })282 ->isInstanceOf('mageekguy\atoum\asserter\exception')283 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 0 time instead of 2'), $asserter->getCall()))284 ->if($call = new test\adapter\call('foo', null, new decorators\addClass($mock)))285 ->and($mock->foo($usedArg = uniqid()))286 ->then287 ->exception(function() use ($asserter) { $asserter->twice(); })288 ->isInstanceOf('mageekguy\atoum\asserter\exception')289 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 1 time instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))290 ->if($mock->foo($secondArg = uniqid()))291 ->then292 ->object($asserter->twice())->isIdenticalTo($asserter)293 ->if($mock->foo($thirdArg = uniqid()))294 ->then295 ->exception(function() use ($asserter) { $asserter->twice(); })296 ->isInstanceOf('mageekguy\atoum\asserter\exception')297 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 3 times instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($secondArg)) . PHP_EOL . '[3] ' . $call->setArguments(array($thirdArg)))298 ->if($mock->getMockController()->resetCalls())299 ->and($asserter->withArguments($usedArg = uniqid()))300 ->then301 ->exception(function() use ($asserter) { $asserter->twice(); })302 ->isInstanceOf('mageekguy\atoum\asserter\exception')303 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 0 time instead of 2'), $asserter->getCall()))304 ->if($mock->foo($usedArg))305 ->then306 ->exception(function() use ($asserter) { $asserter->twice(); })307 ->isInstanceOf('mageekguy\atoum\asserter\exception')308 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 1 time instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))309 ->if($mock->foo($usedArg))310 ->then311 ->object($asserter->twice())->isIdenticalTo($asserter)312 ->if($mock->foo($usedArg))313 ->then314 ->exception(function() use ($asserter) { $asserter->twice(); })315 ->isInstanceOf('mageekguy\atoum\asserter\exception')316 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 3 times instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[3] ' . $call->setArguments(array($usedArg)))317 ->if($asserter->withArguments($arg = uniqid()))318 ->then319 ->exception(function() use ($asserter) { $asserter->twice(); })320 ->isInstanceOf('mageekguy\atoum\asserter\exception')321 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 0 time instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[3] ' . $call->setArguments(array($usedArg)))322 ;323 }324 public function testThrice()325 {326 $this327 ->if($asserter = new sut($generator = new asserter\generator()))328 ->then329 ->exception(function() use ($asserter) { $asserter->thrice(); })330 ->isInstanceOf('mageekguy\atoum\exceptions\logic')331 ->hasMessage('Mock is undefined')332 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))333 ->then334 ->exception(function() use ($asserter) { $asserter->thrice(); })335 ->isInstanceOf('mageekguy\atoum\exceptions\logic')336 ->hasMessage('Call is undefined')337 ->if($asserter->call('foo'))338 ->then339 ->exception(function() use ($asserter) { $asserter->thrice(); })340 ->isInstanceOf('mageekguy\atoum\asserter\exception')341 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 0 time instead of 3'), $asserter->getCall()))342 ->if($call = new test\adapter\call('foo', null, new decorators\addClass($mock)))343 ->and($mock->foo($usedArg = uniqid()))344 ->then345 ->exception(function() use ($asserter) { $asserter->thrice(); })346 ->isInstanceOf('mageekguy\atoum\asserter\exception')347 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 1 time instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))348 ->if($mock->foo($secondArg = uniqid()))349 ->then350 ->exception(function() use ($asserter) { $asserter->thrice(); })351 ->isInstanceOf('mageekguy\atoum\asserter\exception')352 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 2 times instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($secondArg)))353 ->if($mock->foo($thirdArg = uniqid()))354 ->then355 ->object($asserter->thrice())->isIdenticalTo($asserter)356 ->if($mock->foo($fourthArg = uniqid()))357 ->then358 ->exception(function() use ($asserter) { $asserter->thrice(); })359 ->isInstanceOf('mageekguy\atoum\asserter\exception')360 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 4 times instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($secondArg)) . PHP_EOL . '[3] ' . $call->setArguments(array($thirdArg)) . PHP_EOL . '[4] ' . $call->setArguments(array($fourthArg)))361 ->if($mock->getMockController()->resetCalls())362 ->and($asserter->withArguments($usedArg = uniqid()))363 ->then364 ->exception(function() use ($asserter) { $asserter->thrice(); })365 ->isInstanceOf('mageekguy\atoum\asserter\exception')366 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 0 time instead of 3'), $asserter->getCall()))367 ->if($mock->foo($usedArg))368 ->then369 ->exception(function() use ($asserter) { $asserter->thrice(); })370 ->isInstanceOf('mageekguy\atoum\asserter\exception')371 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 1 time instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))372 ->if($mock->foo($usedArg))373 ->then374 ->exception(function() use ($asserter) { $asserter->thrice(); })375 ->isInstanceOf('mageekguy\atoum\asserter\exception')376 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 2 times instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($usedArg)))377 ->if($mock->foo($usedArg))378 ->then379 ->object($asserter->thrice())->isIdenticalTo($asserter)380 ->if($mock->foo($usedArg))381 ->then382 ->exception(function() use ($asserter) { $asserter->thrice(); })383 ->isInstanceOf('mageekguy\atoum\asserter\exception')384 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 4 times instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[3] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[4] ' . $call->setArguments(array($usedArg)))385 ->if($asserter->withArguments($arg = uniqid()))386 ->then387 ->exception(function() use ($asserter) { $asserter->thrice(); })388 ->isInstanceOf('mageekguy\atoum\asserter\exception')389 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 0 time instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[3] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[4] ' . $call->setArguments(array($usedArg)))390 ;391 }392 public function testAtLeastOnce()393 {394 $this395 ->if($asserter = new sut($generator = new asserter\generator()))396 ->then397 ->exception(function() use ($asserter) { $asserter->atLeastOnce(); })398 ->isInstanceOf('mageekguy\atoum\exceptions\logic')399 ->hasMessage('Mock is undefined')400 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))401 ->then402 ->exception(function() use ($asserter) { $asserter->atLeastOnce(); })403 ->isInstanceOf('mageekguy\atoum\exceptions\logic')404 ->hasMessage('Call is undefined')405 ->if($asserter->call('foo'))406 ->then407 ->exception(function() use ($asserter) { $asserter->atLeastOnce(); })408 ->isInstanceOf('mageekguy\atoum\asserter\exception')409 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 0 time'), $asserter->getCall()))410 ->if($mock->foo(uniqid()))411 ->then412 ->object($asserter->atLeastOnce())->isIdenticalTo($asserter)413 ->if($mock->foo(uniqid()))414 ->then415 ->object($asserter->atLeastOnce())->isIdenticalTo($asserter)416 ->if($mock->getMockController()->resetCalls())417 ->and($asserter->withArguments($usedArg = uniqid()))418 ->then419 ->exception(function() use ($asserter) { $asserter->atLeastOnce(); })420 ->isInstanceOf('mageekguy\atoum\asserter\exception')421 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 0 time'), $asserter->getCall()))422 ->if($call = new test\adapter\call('foo', null, new decorators\addClass($mock)))423 ->if( $mock->foo($usedArg))424 ->then425 ->object($asserter->atLeastOnce())->isIdenticalTo($asserter)426 ->if($asserter->withArguments($otherArg = uniqid()))427 ->then428 ->exception(function() use ($asserter) { $asserter->atLeastOnce(); })429 ->isInstanceOf('mageekguy\atoum\asserter\exception')430 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 0 time'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))431 ;432 }433 public function testExactly()434 {435 $this436 ->if($asserter = new sut($generator = new asserter\generator()))437 ->then438 ->exception(function() use ($asserter) { $asserter->exactly(2); })439 ->isInstanceOf('mageekguy\atoum\exceptions\logic')440 ->hasMessage('Mock is undefined')441 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))442 ->then443 ->exception(function() use ($asserter) { $asserter->exactly(2); })444 ->isInstanceOf('mageekguy\atoum\exceptions\logic')445 ->hasMessage('Call is undefined')446 ->if($asserter->call('foo'))447 ->then448 ->exception(function() use ($asserter) { $asserter->exactly(2); })449 ->isInstanceOf('mageekguy\atoum\asserter\exception')450 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 0 time instead of 2'), $asserter->getCall()))451 ->if($call = new test\adapter\call('foo', null, new decorators\addClass($mock)))452 ->and($mock->foo($usedArg = uniqid()))453 ->then454 ->exception(function() use ($asserter) { $asserter->exactly(2); })455 ->isInstanceOf('mageekguy\atoum\asserter\exception')456 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 1 time instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))457 ->if($mock->foo($otherUsedArg = uniqid()))458 ->then459 ->object($asserter->exactly(2))->isIdenticalTo($asserter)460 ->if($mock->foo($anOtherUsedArg = uniqid()))461 ->then462 ->exception(function() use ($asserter) { $asserter->exactly(2); })463 ->isInstanceOf('mageekguy\atoum\asserter\exception')464 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 3 times instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($otherUsedArg)) . PHP_EOL . '[3] ' . $call->setArguments(array($anOtherUsedArg)))465 ->if($mock->getMockController()->resetCalls())466 ->and($asserter->withArguments($arg = uniqid()))467 ->then468 ->exception(function() use ($asserter) { $asserter->exactly(2); })469 ->isInstanceOf('mageekguy\atoum\asserter\exception')470 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 0 time instead of 2'), $asserter->getCall()))471 ->if($mock->foo($usedArg = uniqid()))472 ->then473 ->exception(function() use ($asserter) { $asserter->exactly(2); })474 ->isInstanceOf('mageekguy\atoum\asserter\exception')475 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 0 time instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))476 ->if($mock->foo($arg))477 ->then478 ->exception(function() use ($asserter) { $asserter->exactly(2); })479 ->isInstanceOf('mageekguy\atoum\asserter\exception')480 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 1 time instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($arg)))481 ->if($mock->foo($arg))482 ->then483 ->object($asserter->exactly(2))->isIdenticalTo($asserter)484 ->if($mock->foo($arg))485 ->then486 ->exception(function() use ($asserter) { $asserter->exactly(2); })487 ->isInstanceOf('mageekguy\atoum\asserter\exception')488 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 3 times instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($arg)) . PHP_EOL . '[3] ' . $call->setArguments(array($arg)) . PHP_EOL . '[4] ' . $call->setArguments(array($arg)))489 ->if($call = new test\adapter\call('fooWithSeveralArguments', null, new decorators\addClass($mock)))490 ->and($asserter->call('fooWithSeveralArguments'))491 ->then492 ->object($asserter->exactly(0))->isIdenticalTo($asserter)493 ->exception(function() use ($asserter) { $asserter->exactly(1); })494 ->isInstanceOf('mageekguy\atoum\asserter\exception')495 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 0 time instead of 1'), $asserter->getCall()))496 ->if($mock->fooWithSeveralArguments(1, 2, 3, 4, 5))497 ->then498 ->exception(function() use ($asserter) { $asserter->exactly(0); })499 ->isInstanceOf('mageekguy\atoum\asserter\exception')500 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 1 time instead of 0'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array(1, 2, 3, 4, 5)))501 ->object($asserter->exactly(1))->isIdenticalTo($asserter)502 ->object($asserter->withArguments(1, 2, 3, 4, 5)->exactly(1))->isIdenticalTo($asserter)503 ->object($asserter->withAtLeastArguments(array(1 => 2, 3 => 4))->exactly(1))->isIdenticalTo($asserter)504 ->object($asserter->withAtLeastArguments(array(1 => 2, 3 => rand(6, PHP_INT_MAX)))->exactly(0))->isIdenticalTo($asserter)505 ->exception(function() use ($asserter) { $asserter->withAtLeastArguments(array(1 => 2, 3 => 4))->exactly(0); })506 ->isInstanceOf('mageekguy\atoum\asserter\exception')507 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 1 time instead of 0'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array(1, 2, 3, 4, 5)))508 ->object($asserter->withIdenticalArguments(1, 2, 3, 4, 5)->exactly(1))->isIdenticalTo($asserter)509 ->exception(function() use ($asserter) { $asserter->withAtLeastIdenticalArguments(array(1 => '2', 3 => 4))->exactly(1); })510 ->isInstanceOf('mageekguy\atoum\asserter\exception')511 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 0 time instead of 1'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array(1, 2, 3, 4, 5)))512 ;513 }514 public function testNever()515 {516 $this517 ->if($asserter = new sut($generator = new asserter\generator()))518 ->then519 ->exception(function() use ($asserter) { $asserter->never(); })520 ->isInstanceOf('mageekguy\atoum\exceptions\logic')521 ->hasMessage('Mock is undefined')522 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))523 ->then524 ->exception(function() use ($asserter) { $asserter->never(); })525 ->isInstanceOf('mageekguy\atoum\exceptions\logic')526 ->hasMessage('Call is undefined')527 ->if($asserter->call('foo'))528 ->then529 ->object($asserter->never())->isIdenticalTo($asserter)530 ->if($call = new test\adapter\call('foo', null, new decorators\addClass($mock)))531 ->and($mock->foo($usedArg = uniqid()))532 ->then533 ->exception(function() use ($asserter) { $asserter->never(); })534 ->isInstanceOf('mageekguy\atoum\asserter\exception')535 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 1 time instead of 0'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))536 ->if($mock->getMockController()->resetCalls())537 ->and($asserter->withArguments($arg = uniqid()))538 ->then539 ->object($asserter->never())->isIdenticalTo($asserter)540 ->if($mock->foo($arg))541 ->then542 ->exception(function() use ($asserter) { $asserter->never(); })543 ->isInstanceOf('mageekguy\atoum\asserter\exception')544 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 1 time instead of 0'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($arg)))545 ->if($mock->foo($arg))546 ->then547 ->exception(function() use ($asserter) { $asserter->never(); })548 ->isInstanceOf('mageekguy\atoum\asserter\exception')549 ->hasMessage(sprintf($generator->getLocale()->_('%s is called 2 times instead of 0'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($arg)) . PHP_EOL . '[2] ' . $call->setArguments(array($arg)))550 ->if($mock->foo($arg))551 ->then552 ->exception(function() use ($asserter, & $message) { $asserter->never($message = uniqid()); })553 ->isInstanceOf('mageekguy\atoum\asserter\exception')554 ->hasMessage($message)555 ->if($asserter->withArguments(uniqid()))556 ->then557 ->object($asserter->never())->isIdenticalTo($asserter)558 ;559 }560}...

Full Screen

Full Screen

utf8String.php

Source:utf8String.php Github

copy

Full Screen

...19 $this20 ->if($asserter = new sut())21 ->then22 ->object($asserter->getGenerator())->isEqualTo(new asserter\generator())23 ->object($asserter->getLocale())->isIdenticalTo($asserter->getGenerator()->getLocale())24 ->object($asserter->getAdapter())->isEqualTo(new atoum\adapter())25 ->variable($asserter->getValue())->isNull()26 ->boolean($asserter->wasSet())->isFalse()27 ->if($asserter = new sut($generator = new asserter\generator()))28 ->then29 ->object($asserter->getGenerator())->isIdenticalTo($generator)30 ->object($asserter->getLocale())->isIdenticalTo($generator->getLocale())31 ->object($asserter->getAdapter())->isEqualTo(new atoum\adapter())32 ->variable($asserter->getValue())->isNull()33 ->boolean($asserter->wasSet())->isFalse()34 ->if($adapter = new atoum\test\adapter())35 ->and($adapter->extension_loaded = true)36 ->and($asserter = new sut($generator = new asserter\generator(), $adapter))37 ->then38 ->object($asserter->getGenerator())->isIdenticalTo($generator)39 ->object($asserter->getLocale())->isIdenticalTo($generator->getLocale())40 ->object($asserter->getAdapter())->isEqualTo($adapter)41 ->variable($asserter->getValue())->isNull()42 ->boolean($asserter->wasSet())->isFalse()43 ->if($adapter->extension_loaded = false)44 ->then45 ->exception(function() use ($adapter) { new sut(new asserter\generator(), $adapter); })46 ->isInstanceOf('mageekguy\atoum\exceptions\runtime')47 ->hasMessage('mbstring PHP extension is mandatory to use utf8String asserter')48 ;49 }50 public function test__toString()51 {52 $this53 ->if($asserter = new sut($generator = new asserter\generator()))54 ->and($asserter->setWith($value = $this->getRandomUtf8String()))55 ->then56 ->castToString($asserter)->isEqualTo('string(' . mb_strlen($value, 'UTF-8') . ') \'' . $value . '\'')57 ->if($asserter->setWith($value = "\010" . $this->getRandomUtf8String() . "\010", null, $charlist = "\010"))58 ->then59 ->castToString($asserter)->isEqualTo('string(' . mb_strlen($value, 'UTF-8') . ') \'' . addcslashes($value, "\010") . '\'')60 ;61 }62 public function testSetWith()63 {64 $this65 ->if($asserter = new sut($generator = new asserter\generator()))66 ->then67 ->exception(function() use ($asserter, & $value) { $asserter->setwith($value = rand(- PHP_INT_MAX, PHP_INT_MAX)); })68 ->isinstanceof('mageekguy\atoum\asserter\exception')69 ->hasmessage(sprintf($generator->getlocale()->_('%s is not a string'), $asserter->gettypeof($value)))70 ->exception(function() use ($asserter, & $value) { $asserter->setwith("\xf0\x28\x8c\xbc"); })71 ->isinstanceof('mageekguy\atoum\asserter\exception')72 ->hasmessage(sprintf($generator->getlocale()->_('\'%s\' is not an UTF-8 string'), "\xf0\x28\x8c\xbc"))73 ->exception(function() use ($asserter, & $value) { $asserter->setwith("\xf8\xa1\xa1\xa1\xa1"); })74 ->isinstanceof('mageekguy\atoum\asserter\exception')75 ->hasmessage(sprintf($generator->getlocale()->_('\'%s\' is not an UTF-8 string'), "\xf8\xa1\xa1\xa1\xa1"))76 ->object($asserter->setWith(uniqid()))->isIdenticalTo($asserter)77 ;78 }79 public function testIsEqualTo()80 {81 $this82 ->if($asserter = new sut($generator = new asserter\generator()))83 ->then84 ->boolean($asserter->wasSet())->isFalse()85 ->exception(function() use ($asserter) { $asserter->isEqualTo(uniqid()); })86 ->isInstanceOf('mageekguy\atoum\exceptions\logic')87 ->hasMessage('Value is undefined')88 ->if($asserter->setWith($firstString = $this->getRandomUtf8String()))89 ->and($diff = new diffs\variable())90 ->and($secondString = $this->getRandomUtf8String())91 ->then92 ->exception(function() use ($asserter, $secondString) { $asserter->isEqualTo($secondString); })93 ->isInstanceOf('mageekguy\atoum\asserter\exception')94 ->hasMessage($generator->getLocale()->_('strings are not equals') . PHP_EOL . $diff->setExpected($secondString)->setActual($firstString))95 ->object($asserter->isEqualTo($firstString))->isIdenticalTo($asserter)96 ;97 }98 public function testIsEqualToFileContents()99 {100 $this101 ->if($asserter = new sut($generator = new asserter\generator(), $adapter = new atoum\test\adapter()))102 ->then103 ->boolean($asserter->wasSet())->isFalse()104 ->exception(function() use ($asserter) { $asserter->isEqualToContentsOfFile(uniqid()); })105 ->isInstanceOf('mageekguy\atoum\exceptions\logic')106 ->hasMessage('Value is undefined')107 ->if($asserter->setWith($firstString = $this->getRandomUtf8String()))108 ->and($adapter->file_get_contents = false)109 ->then110 ->exception(function() use ($asserter, & $path) { $asserter->isEqualToContentsOfFile($path = uniqid()); })111 ->isInstanceOf('mageekguy\atoum\asserter\exception')112 ->hasMessage(sprintf($generator->getLocale()->_('Unable to get contents of file %s'), $path))113 ->if($adapter->file_get_contents = $fileContents = $this->getRandomUtf8String())114 ->and($diff = new diffs\variable())115 ->then116 ->exception(function() use ($asserter, & $path) { $asserter->isEqualToContentsOfFile($path); })117 ->isInstanceOf('mageekguy\atoum\asserter\exception')118 ->hasMessage(sprintf($generator->getLocale()->_('string is not equals to contents of file %s'), $path) . PHP_EOL . $diff->setExpected($fileContents)->setActual($firstString))119 ->if($adapter->file_get_contents = $firstString)120 ->then121 ->object($asserter->isEqualToContentsOfFile($this->getRandomUtf8String()))->isIdenticalTo($asserter)122 ;123 }124 public function testIsEmpty()125 {126 $this127 ->if($asserter = new sut($generator = new asserter\generator()))128 ->then129 ->exception(function() use ($asserter) { $asserter->isEmpty(); })130 ->isInstanceOf('mageekguy\atoum\exceptions\logic')131 ->hasMessage('Value is undefined')132 ->if($asserter->setWith($string = $this->getRandomUtf8String()))133 ->and($diff = new diffs\variable())134 ->then135 ->exception(function() use ($asserter) { $asserter->isEmpty(); })136 ->isInstanceOf('mageekguy\atoum\asserter\exception')137 ->hasMessage($generator->getLocale()->_('strings are not equals') . PHP_EOL . $diff->setExpected('')->setActual($string))138 ->if($asserter->setWith(''))139 ->then140 ->object($asserter->isEmpty())->isIdenticalTo($asserter)141 ;142 }143 public function testIsNotEmpty()144 {145 $this146 ->if($asserter = new sut($generator = new asserter\generator()))147 ->then148 ->exception(function() use ($asserter) { $asserter->isNotEmpty(); })149 ->isInstanceOf('mageekguy\atoum\exceptions\logic')150 ->hasMessage('Value is undefined')151 ->if($asserter->setWith(''))152 ->and($diff = new diffs\variable())153 ->then154 ->exception(function() use ($asserter) { $asserter->isNotEmpty(); })155 ->isInstanceOf('mageekguy\atoum\asserter\exception')156 ->hasMessage($generator->getLocale()->_('string is empty'))157 ->if($asserter->setWith($string = $this->getRandomUtf8String()))158 ->then159 ->object($asserter->isNotEmpty())->isIdenticalTo($asserter)160 ;161 }162 public function testHasLength()163 {164 $this165 ->if($asserter = new sut($generator = new asserter\generator()))166 ->then167 ->exception(function() use ($asserter) { $asserter->hasLength(rand(0, PHP_INT_MAX)); })168 ->isInstanceOf('mageekguy\atoum\exceptions\logic')169 ->hasMessage('Value is undefined')170 ->if($asserter->setWith(''))171 ->and($diff = new diffs\variable())172 ->then173 ->exception(function() use ($asserter, & $requiredLength) { $asserter->hasLength($requiredLength = rand(1, PHP_INT_MAX)); })174 ->isInstanceOf('mageekguy\atoum\asserter\exception')175 ->hasMessage(sprintf($generator->getLocale()->_('length of %s is not %d'), $asserter->getTypeOf(''), $requiredLength))176 ->object($asserter->hasLength(0))->isIdenticalTo($asserter)177 ->if($asserter->setWith($string = $this->getRandomUtf8String()))178 ->then179 ->object($asserter->hasLength(mb_strlen($string, 'UTF-8')))->isIdenticalTo($asserter)180 ;181 }182 public function testHasLengthGreaterThan()183 {184 $this185 ->if($asserter = new sut($generator = new asserter\generator()))186 ->then187 ->exception(function() use ($asserter) { $asserter->hasLengthGreaterThan(rand(0, PHP_INT_MAX)); })188 ->isInstanceOf('mageekguy\atoum\exceptions\logic')189 ->hasMessage('Value is undefined')190 ->if($asserter->setWith($string = $this->getRandomUtf8String()))191 ->and($diff = new diffs\variable())192 ->then193 ->exception(function() use ($asserter, $string) { $asserter->hasLengthGreaterThan(mb_strlen($string, 'UTF-8')); })194 ->isInstanceOf('mageekguy\atoum\asserter\exception')195 ->hasMessage(sprintf($generator->getLocale()->_('length of %s is not greater than %d'), $asserter->getTypeOf($string), mb_strlen($string, 'UTF-8')))196 ->object($asserter->hasLengthGreaterThan(0))->isIdenticalTo($asserter)197 ->if($asserter->setWith($string = $this->getRandomUtf8String()))198 ->then199 ->object($asserter->hasLengthGreaterThan(mb_strlen($string, 'UTF-8') - 1))->isIdenticalTo($asserter)200 ;201 }202 public function testHasLengthLessThan()203 {204 $this205 ->if($asserter = new sut($generator = new asserter\generator()))206 ->then207 ->exception(function() use ($asserter) { $asserter->hasLengthLessThan(rand(0, PHP_INT_MAX)); })208 ->isInstanceOf('mageekguy\atoum\exceptions\logic')209 ->hasMessage('Value is undefined')210 ->if($asserter->setWith($string = $this->getRandomUtf8String()))211 ->and($diff = new diffs\variable())212 ->then213 ->exception(function() use ($asserter, $string) { $asserter->hasLengthLessThan(mb_strlen($string, 'UTF-8')); })214 ->isInstanceOf('mageekguy\atoum\asserter\exception')215 ->hasMessage(sprintf($generator->getLocale()->_('length of %s is not less than %d'), $asserter->getTypeOf($string), mb_strlen($string, 'UTF-8')))216 ->object($asserter->hasLengthLessThan(20))->isIdenticalTo($asserter)217 ->if($asserter->setWith($string = $this->getRandomUtf8String()))218 ->then219 ->object($asserter->hasLengthLessThan(mb_strlen($string, 'UTF-8') + 1))->isIdenticalTo($asserter)220 ;221 }222 public function testContains()223 {224 $this225 ->if($asserter = new sut($generator = new asserter\generator()))226 ->then227 ->exception(function() use ($asserter) { $asserter->contains(uniqid()); })228 ->isInstanceOf('mageekguy\atoum\exceptions\logic')229 ->hasMessage('Value is undefined')230 ->if($asserter->setWith($string = $this->getRandomUtf8String()))231 ->and($diff = new diffs\variable())232 ->and($fragment = $this->getRandomUtf8String())233 ->then234 ->exception(function() use ($asserter, $fragment) { $asserter->contains($fragment); })235 ->isInstanceOf('mageekguy\atoum\asserter\exception')236 ->hasMessage(sprintf($this->getLocale()->_('String does not contain %s'), $fragment))237 ->object($asserter->contains($string))->isIdenticalTo($asserter)238 ->if($asserter->setWith($this->getRandomUtf8String() . $string . $this->getRandomUtf8String()))239 ->then240 ->object($asserter->contains($string))->isIdenticalTo($asserter)241 ->exception(function() use ($asserter, $string, & $fragment) { $asserter->contains($fragment = mb_strtoupper($string, 'UTF-8')); })242 ->isInstanceOf('mageekguy\atoum\asserter\exception')243 ->hasMessage(sprintf($this->getLocale()->_('String does not contain %s'), $fragment))244 ->exception(function() use ($asserter) {245 $asserter->contains("\xf0\x28\x8c\xbc");246 }247 )248 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')249 ->hasMessage('Fragment \'' . "\xf0\x28\x8c\xbc" . '\' is not an UTF-8 string')250 ;251 }252 public function testNotContains()253 {254 $this255 ->if($asserter = new sut($generator = new asserter\generator()))256 ->then257 ->exception(function() use ($asserter) { $asserter->notContains(uniqid()); })258 ->isInstanceOf('mageekguy\atoum\exceptions\logic')259 ->hasMessage('Value is undefined')260 ->if($asserter->setWith($string = 'FreeAgent scans the field'))261 ->and($fragment = 'Agent')262 ->then263 ->exception(function() use ($asserter, $fragment) { $asserter->notContains($fragment); })264 ->isInstanceOf('mageekguy\atoum\asserter\exception')265 ->hasMessage(sprintf($this->getLocale()->_('String contains %s'), $fragment))266 ->object($asserter->notContains('coach'))->isIdenticalTo($asserter)267 ->exception(function() use ($asserter) {268 $asserter->notContains("\xf0\x28\x8c\xbc");269 }270 )271 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')272 ->hasMessage('Fragment \'' . "\xf0\x28\x8c\xbc" . '\' is not an UTF-8 string')273 ;274 }275 public function testStartWith()276 {277 $this278 ->if($asserter = new sut($generator = new asserter\generator()))279 ->then280 ->exception(function() use ($asserter) { $asserter->startWith(uniqid()); })281 ->isInstanceOf('mageekguy\atoum\exceptions\logic')282 ->hasMessage('Value is undefined')283 ->if($asserter->setWith($string = $this->getRandomUtf8String()))284 ->and($diff = new diffs\variable())285 ->and($fragment = $this->getRandomUtf8String())286 ->then287 ->exception(function() use ($asserter, $fragment) { $asserter->startWith($fragment); })288 ->isInstanceOf('mageekguy\atoum\asserter\exception')289 ->hasMessage(sprintf($this->getLocale()->_('String does not start with %s'), $fragment))290 ->object($asserter->startWith($string))->isIdenticalTo($asserter)291 ->if($asserter->setWith(uniqid() . $string))292 ->then293 ->exception(function() use ($asserter, $string) { $asserter->startWith($string); })294 ->isInstanceOf('mageekguy\atoum\asserter\exception')295 ->hasMessage(sprintf($this->getLocale()->_('String does not start with %s'), $string))296 ->if($asserter->setWith($string . uniqid()))297 ->then298 ->object($asserter->startWith($string))->isIdenticalTo($asserter)299 ->exception(function() use ($asserter, $string, & $fragment) { $asserter->startWith($fragment = mb_strtoupper($string, 'UTF-8')); })300 ->isInstanceOf('mageekguy\atoum\asserter\exception')301 ->hasMessage(sprintf($this->getLocale()->_('String does not start with %s'), $fragment))302 ;303 }304 public function testNotStartWith()305 {306 $this307 ->if($asserter = new sut($generator = new asserter\generator()))308 ->then309 ->exception(function() use ($asserter) { $asserter->notStartWith(uniqid()); })310 ->isInstanceOf('mageekguy\atoum\exceptions\logic')311 ->hasMessage('Value is undefined')312 ->if($asserter->setWith($string = $this->getRandomUtf8String()))313 ->then314 ->exception(function() use ($asserter, $string) { $asserter->notStartWith($string); })315 ->isInstanceOf('mageekguy\atoum\asserter\exception')316 ->hasMessage(sprintf($this->getLocale()->_('String start with %s'), $string))317 ->object($asserter->notStartWith(uniqid()))->isIdenticalTo($asserter)318 ;319 }320 public function testEndWith()321 {322 $this323 ->if($asserter = new sut($generator = new asserter\generator()))324 ->then325 ->exception(function() use ($asserter) { $asserter->endWith(uniqid()); })326 ->isInstanceOf('mageekguy\atoum\exceptions\logic')327 ->hasMessage('Value is undefined')328 ->if($asserter->setWith($string = $this->getRandomUtf8String()))329 ->and($diff = new diffs\variable())330 ->and($fragment = $this->getRandomUtf8String())331 ->then332 ->exception(function() use ($asserter, $fragment) { $asserter->endWith($fragment); })333 ->isInstanceOf('mageekguy\atoum\asserter\exception')334 ->hasMessage(sprintf($this->getLocale()->_('String does not end with %s'), $fragment))335 ->object($asserter->endWith($string))->isIdenticalTo($asserter)336 ->if($asserter->setWith($string . uniqid()))337 ->then338 ->exception(function() use ($asserter, $string) { $asserter->endWith($string); })339 ->isInstanceOf('mageekguy\atoum\asserter\exception')340 ->hasMessage(sprintf($this->getLocale()->_('String does not end with %s'), $string))341 ->if($asserter->setWith(uniqid() . $string))342 ->then343 ->object($asserter->endWith($string))->isIdenticalTo($asserter)344 ->exception(function() use ($asserter, $string, & $fragment) { $asserter->endWith($fragment = mb_strtoupper($string, 'UTF-8')); })345 ->isInstanceOf('mageekguy\atoum\asserter\exception')346 ->hasMessage(sprintf($this->getLocale()->_('String does not end with %s'), $fragment))347 ;348 }349 public function testNotEndWith()350 {351 $this352 ->if($asserter = new sut($generator = new asserter\generator()))353 ->then354 ->exception(function() use ($asserter) { $asserter->notEndWith(uniqid()); })355 ->isInstanceOf('mageekguy\atoum\exceptions\logic')356 ->hasMessage('Value is undefined')357 ->if($asserter->setWith($string = $this->getRandomUtf8String()))358 ->then359 ->exception(function() use ($asserter, $string) { $asserter->notEndWith($string); })360 ->isInstanceOf('mageekguy\atoum\asserter\exception')361 ->hasMessage(sprintf($this->getLocale()->_('String end with %s'), $string))362 ->object($asserter->notEndWith(uniqid()))->isIdenticalTo($asserter)363 ;364 }365 public function testLength()366 {367 $this368 ->if($asserter = new sut($generator = new asserter\generator()))369 ->then370 ->exception(function() use ($asserter) { $asserter->length; })371 ->isInstanceOf('mageekguy\atoum\exceptions\logic')372 ->hasMessage('Value is undefined')373 ->if($asserter->setWith(''))374 ->then375 ->object($integer = $asserter->length)...

Full Screen

Full Screen

string.php

Source:string.php Github

copy

Full Screen

...18 $this19 ->if($asserter = new sut())20 ->then21 ->object($asserter->getGenerator())->isEqualTo(new asserter\generator())22 ->object($asserter->getLocale())->isIdenticalTo($asserter->getGenerator()->getLocale())23 ->object($asserter->getAdapter())->isEqualTo(new atoum\adapter())24 ->variable($asserter->getValue())->isNull()25 ->boolean($asserter->wasSet())->isFalse()26 ->if($asserter = new sut($generator = new asserter\generator(), $adapter = new atoum\adapter()))27 ->then28 ->object($asserter->getLocale())->isIdenticalTo($generator->getLocale())29 ->object($asserter->getGenerator())->isIdenticalTo($generator)30 ->object($asserter->getAdapter())->isIdenticalTo($adapter)31 ->variable($asserter->getValue())->isNull()32 ->boolean($asserter->wasSet())->isFalse()33 ;34 }35 public function test__toString()36 {37 $this38 ->if($asserter = new sut($generator = new asserter\generator()))39 ->and($asserter->setWith($value = uniqid()))40 ->then41 ->castToString($asserter)->isEqualTo('string(' . strlen($value) . ') \'' . $value . '\'')42 ->if($asserter->setWith($value = "\010" . uniqid() . "\010", null, $charlist = "\010"))43 ->then44 ->castToString($asserter)->isEqualTo('string(' . strlen($value) . ') \'' . addcslashes($value, "\010") . '\'')45 ;46 }47 public function testSetAdapter()48 {49 $this50 ->if($asserter = new sut())51 ->then52 ->object($asserter->setAdapter($adapter = new atoum\adapter()))->isIdenticalTo($asserter)53 ->object($asserter->getAdapter())->isIdenticalTo($adapter)54 ->object($asserter->setAdapter())->isIdenticalTo($asserter)55 ->object($asserter->getAdapter())56 ->isNotIdenticalTo($adapter)57 ->isEqualTo(new atoum\adapter())58 ;59 }60 public function testSetWith()61 {62 $this63 ->if($asserter = new sut($generator = new asserter\generator()))64 ->then65 ->exception(function() use (& $line, $asserter, & $value) { $line = __LINE__; $asserter->setWith($value = rand(- PHP_INT_MAX, PHP_INT_MAX)); })66 ->isInstanceOf('mageekguy\atoum\asserter\exception')67 ->hasMessage(sprintf($generator->getLocale()->_('%s is not a string'), $asserter->getTypeOf($value)))68 ->integer($asserter->getValue())->isEqualTo($value)69 ->variable($asserter->getCharlist())->isNull()70 ->object($asserter->setWith($value = uniqid()))->isIdenticalTo($asserter)71 ->string($asserter->getValue())->isEqualTo($value)72 ->variable($asserter->getCharlist())->isNull()73 ->object($asserter->setWith($value = uniqid(), null, $charlist = "\010"))->isIdenticalTo($asserter)74 ->string($asserter->getValue())->isEqualTo($value)75 ->string($asserter->getCharlist())->isEqualTo($charlist)76 ;77 }78 public function testIsEqualTo()79 {80 $this81 ->if($asserter = new sut($generator = new asserter\generator()))82 ->then83 ->boolean($asserter->wasSet())->isFalse()84 ->exception(function() use ($asserter) { $asserter->isEqualTo(uniqid()); })85 ->isInstanceOf('mageekguy\atoum\exceptions\logic')86 ->hasMessage('Value is undefined')87 ->if($asserter->setWith($firstString = uniqid()))88 ->and($diff = new diffs\variable())89 ->then90 ->exception(function() use ($asserter, & $secondString) { $asserter->isEqualTo($secondString = uniqid()); })91 ->isInstanceOf('mageekguy\atoum\asserter\exception')92 ->hasMessage($generator->getLocale()->_('strings are not equals') . PHP_EOL . $diff->setExpected($secondString)->setActual($firstString))93 ->object($asserter->isEqualTo($firstString))->isIdenticalTo($asserter)94 ;95 }96 public function testIsEqualToFileContents()97 {98 $this99 ->if($asserter = new sut($generator = new asserter\generator(), $adapter = new atoum\test\adapter()))100 ->then101 ->boolean($asserter->wasSet())->isFalse()102 ->exception(function() use ($asserter) { $asserter->isEqualToContentsOfFile(uniqid()); })103 ->isInstanceOf('mageekguy\atoum\exceptions\logic')104 ->hasMessage('Value is undefined')105 ->if($asserter->setWith($firstString = uniqid()))106 ->and($adapter->file_get_contents = false)107 ->then108 ->exception(function() use ($asserter, & $path) { $asserter->isEqualToContentsOfFile($path = uniqid()); })109 ->isInstanceOf('mageekguy\atoum\asserter\exception')110 ->hasMessage(sprintf($generator->getLocale()->_('Unable to get contents of file %s'), $path))111 ->if($adapter->file_get_contents = $fileContents = uniqid())112 ->and($diff = new diffs\variable())113 ->then114 ->exception(function() use ($asserter, & $path) { $asserter->isEqualToContentsOfFile($path); })115 ->isInstanceOf('mageekguy\atoum\asserter\exception')116 ->hasMessage(sprintf($generator->getLocale()->_('string is not equals to contents of file %s'), $path) . PHP_EOL . $diff->setExpected($fileContents)->setActual($firstString))117 ->if($adapter->file_get_contents = $firstString)118 ->then119 ->object($asserter->isEqualToContentsOfFile(uniqid()))->isIdenticalTo($asserter)120 ;121 }122 public function testIsEmpty()123 {124 $this125 ->if($asserter = new sut($generator = new asserter\generator()))126 ->then127 ->exception(function() use ($asserter) { $asserter->isEmpty(); })128 ->isInstanceOf('mageekguy\atoum\exceptions\logic')129 ->hasMessage('Value is undefined')130 ->if($asserter->setWith($string = uniqid()))131 ->and($diff = new diffs\variable())132 ->then133 ->exception(function() use ($asserter) { $asserter->isEmpty(); })134 ->isInstanceOf('mageekguy\atoum\asserter\exception')135 ->hasMessage($generator->getLocale()->_('strings are not equals') . PHP_EOL . $diff->setExpected('')->setActual($string))136 ->if($asserter->setWith(''))137 ->then138 ->object($asserter->isEmpty())->isIdenticalTo($asserter)139 ;140 }141 public function testIsNotEmpty()142 {143 $this144 ->if($asserter = new sut($generator = new asserter\generator()))145 ->then146 ->exception(function() use ($asserter) { $asserter->isNotEmpty(); })147 ->isInstanceOf('mageekguy\atoum\exceptions\logic')148 ->hasMessage('Value is undefined')149 ->if($asserter->setWith(''))150 ->and($diff = new diffs\variable())151 ->then152 ->exception(function() use ($asserter) { $asserter->isNotEmpty(); })153 ->isInstanceOf('mageekguy\atoum\asserter\exception')154 ->hasMessage($generator->getLocale()->_('string is empty'))155 ->if($asserter->setWith($string = uniqid()))156 ->then157 ->object($asserter->isNotEmpty())->isIdenticalTo($asserter)158 ;159 }160 public function testHasLength()161 {162 $this163 ->if($asserter = new sut($generator = new asserter\generator()))164 ->then165 ->exception(function() use ($asserter) { $asserter->hasLength(rand(0, PHP_INT_MAX)); })166 ->isInstanceOf('mageekguy\atoum\exceptions\logic')167 ->hasMessage('Value is undefined')168 ->if($asserter->setWith(''))169 ->and($diff = new diffs\variable())170 ->then171 ->exception(function() use ($asserter, & $requiredLength) { $asserter->hasLength($requiredLength = rand(1, PHP_INT_MAX)); })172 ->isInstanceOf('mageekguy\atoum\asserter\exception')173 ->hasMessage(sprintf($generator->getLocale()->_('length of %s is not %d'), $asserter->getTypeOf(''), $requiredLength))174 ->object($asserter->hasLength(0))->isIdenticalTo($asserter)175 ->if($asserter->setWith($string = uniqid()))176 ->then177 ->object($asserter->hasLength(strlen($string)))->isIdenticalTo($asserter)178 ;179 }180 public function testHasLengthGreaterThan()181 {182 $this183 ->if($asserter = new sut($generator = new asserter\generator()))184 ->then185 ->exception(function() use ($asserter) { $asserter->hasLengthGreaterThan(rand(0, PHP_INT_MAX)); })186 ->isInstanceOf('mageekguy\atoum\exceptions\logic')187 ->hasMessage('Value is undefined')188 ->if($asserter->setWith('Chuck Norris'))189 ->and($diff = new diffs\variable())190 ->then191 ->exception(function() use ($asserter, & $requiredLength) { $asserter->hasLengthGreaterThan($requiredLength = rand(1, PHP_INT_MAX)); })192 ->isInstanceOf('mageekguy\atoum\asserter\exception')193 ->hasMessage(sprintf($generator->getLocale()->_('length of %s is not greater than %d'), $asserter->getTypeOf('Chuck Norris'), $requiredLength))194 ->object($asserter->hasLengthGreaterThan(0))->isIdenticalTo($asserter)195 ->if($asserter->setWith($string = uniqid()))196 ->then197 ->object($asserter->hasLengthGreaterThan(strlen($string)-1))->isIdenticalTo($asserter)198 ;199 }200 public function testHasLengthLessThan()201 {202 $this203 ->if($asserter = new sut($generator = new asserter\generator()))204 ->then205 ->exception(function() use ($asserter) { $asserter->hasLengthLessThan(rand(0, PHP_INT_MAX)); })206 ->isInstanceOf('mageekguy\atoum\exceptions\logic')207 ->hasMessage('Value is undefined')208 ->if($asserter->setWith('Chuck Norris'))209 ->and($diff = new diffs\variable())210 ->then211 ->exception(function() use ($asserter, & $requiredLength) { $asserter->hasLengthLessThan($requiredLength = 10); })212 ->isInstanceOf('mageekguy\atoum\asserter\exception')213 ->hasMessage(sprintf($generator->getLocale()->_('length of %s is not less than %d'), $asserter->getTypeOf('Chuck Norris'), $requiredLength))214 ->object($asserter->hasLengthLessThan(20))->isIdenticalTo($asserter)215 ->if($asserter->setWith($string = uniqid()))216 ->then217 ->object($asserter->hasLengthLessThan(strlen($string)+1))->isIdenticalTo($asserter)218 ;219 }220 public function testContains()221 {222 $this223 ->if($asserter = new sut($generator = new asserter\generator()))224 ->then225 ->exception(function() use ($asserter) { $asserter->contains(uniqid()); })226 ->isInstanceOf('mageekguy\atoum\exceptions\logic')227 ->hasMessage('Value is undefined')228 ->if($asserter->setWith($string = __METHOD__))229 ->and($diff = new diffs\variable())230 ->then231 ->exception(function() use ($asserter, & $fragment) { $asserter->contains($fragment = uniqid()); })232 ->isInstanceOf('mageekguy\atoum\asserter\exception')233 ->hasMessage(sprintf($this->getLocale()->_('String does not contain %s'), $fragment))234 ->object($asserter->contains($string))->isIdenticalTo($asserter)235 ->if($asserter->setWith(uniqid() . $string . uniqid()))236 ->then237 ->object($asserter->contains($string))->isIdenticalTo($asserter)238 ->exception(function() use ($asserter, $string, & $fragment) { $asserter->contains($fragment = strtoupper($string)); })239 ->isInstanceOf('mageekguy\atoum\asserter\exception')240 ->hasMessage(sprintf($this->getLocale()->_('String does not contain %s'), $fragment))241 ;242 }243 public function testNotContains()244 {245 $this246 ->if($asserter = new sut($generator = new asserter\generator()))247 ->then248 ->exception(function() use ($asserter) { $asserter->notContains(uniqid()); })249 ->isInstanceOf('mageekguy\atoum\exceptions\logic')250 ->hasMessage('Value is undefined')251 ->if($asserter->setWith($string = 'FreeAgent scans the field'))252 ->then253 ->exception(function() use ($asserter, & $fragment) { $asserter->notContains($fragment = 'Agent'); })254 ->isInstanceOf('mageekguy\atoum\asserter\exception')255 ->hasMessage(sprintf($this->getLocale()->_('String contains %s'), $fragment))256 ->object($asserter->notContains('coach'))->isIdenticalTo($asserter)257 ;258 }259 public function testStartWith()260 {261 $this262 ->if($asserter = new sut($generator = new asserter\generator()))263 ->then264 ->exception(function() use ($asserter) { $asserter->startWith(uniqid()); })265 ->isInstanceOf('mageekguy\atoum\exceptions\logic')266 ->hasMessage('Value is undefined')267 ->if($asserter->setWith($string = __METHOD__))268 ->and($diff = new diffs\variable())269 ->then270 ->exception(function() use ($asserter, & $fragment) { $asserter->startWith($fragment = uniqid()); })271 ->isInstanceOf('mageekguy\atoum\asserter\exception')272 ->hasMessage(sprintf($this->getLocale()->_('String does not start with %s'), $fragment))273 ->object($asserter->startWith($string))->isIdenticalTo($asserter)274 ->if($asserter->setWith(uniqid() . $string))275 ->then276 ->exception(function() use ($asserter, $string) { $asserter->startWith($string); })277 ->isInstanceOf('mageekguy\atoum\asserter\exception')278 ->hasMessage(sprintf($this->getLocale()->_('String does not start with %s'), $string))279 ->if($asserter->setWith($string . uniqid()))280 ->then281 ->object($asserter->startWith($string))->isIdenticalTo($asserter)282 ->exception(function() use ($asserter, $string, & $fragment) { $asserter->startWith($fragment = strtoupper($string)); })283 ->isInstanceOf('mageekguy\atoum\asserter\exception')284 ->hasMessage(sprintf($this->getLocale()->_('String does not start with %s'), $fragment))285 ;286 }287 public function testNotStartWith()288 {289 $this290 ->if($asserter = new sut($generator = new asserter\generator()))291 ->then292 ->exception(function() use ($asserter) { $asserter->notStartWith(uniqid()); })293 ->isInstanceOf('mageekguy\atoum\exceptions\logic')294 ->hasMessage('Value is undefined')295 ->if($asserter->setWith($string = __METHOD__))296 ->then297 ->exception(function() use ($asserter, & $fragment) { $asserter->notStartWith($fragment = __NAMESPACE__); })298 ->isInstanceOf('mageekguy\atoum\asserter\exception')299 ->hasMessage(sprintf($this->getLocale()->_('String start with %s'), $fragment))300 ->object($asserter->notStartWith(uniqid()))->isIdenticalTo($asserter)301 ;302 }303 public function testEndWith()304 {305 $this306 ->if($asserter = new sut($generator = new asserter\generator()))307 ->then308 ->exception(function() use ($asserter) { $asserter->endWith(uniqid()); })309 ->isInstanceOf('mageekguy\atoum\exceptions\logic')310 ->hasMessage('Value is undefined')311 ->if($asserter->setWith($string = __METHOD__))312 ->and($diff = new diffs\variable())313 ->then314 ->exception(function() use ($asserter, & $fragment) { $asserter->endWith($fragment = uniqid()); })315 ->isInstanceOf('mageekguy\atoum\asserter\exception')316 ->hasMessage(sprintf($this->getLocale()->_('String does not end with %s'), $fragment))317 ->object($asserter->endWith($string))->isIdenticalTo($asserter)318 ->if($asserter->setWith($string . uniqid()))319 ->then320 ->exception(function() use ($asserter, $string) { $asserter->endWith($string); })321 ->isInstanceOf('mageekguy\atoum\asserter\exception')322 ->hasMessage(sprintf($this->getLocale()->_('String does not end with %s'), $string))323 ->if($asserter->setWith(uniqid() . $string))324 ->then325 ->object($asserter->endWith($string))->isIdenticalTo($asserter)326 ->exception(function() use ($asserter, $string, & $fragment) { $asserter->endWith($fragment = strtoupper($string)); })327 ->isInstanceOf('mageekguy\atoum\asserter\exception')328 ->hasMessage(sprintf($this->getLocale()->_('String does not end with %s'), $fragment))329 ;330 }331 public function testNotEndWith()332 {333 $this334 ->if($asserter = new sut($generator = new asserter\generator()))335 ->then336 ->exception(function() use ($asserter) { $asserter->notEndWith(uniqid()); })337 ->isInstanceOf('mageekguy\atoum\exceptions\logic')338 ->hasMessage('Value is undefined')339 ->if($asserter->setWith($string = __METHOD__))340 ->and($fragment = __FUNCTION__)341 ->then342 ->exception(function() use ($asserter, $fragment) { $asserter->notEndWith($fragment); })343 ->isInstanceOf('mageekguy\atoum\asserter\exception')344 ->hasMessage(sprintf($this->getLocale()->_('String end with %s'), $fragment))345 ->object($asserter->notEndWith(uniqid()))->isIdenticalTo($asserter)346 ;347 }348 public function testLength()349 {350 $this351 ->if($asserter = new sut($generator = new asserter\generator()))352 ->then353 ->exception(function() use ($asserter) { $asserter->length; })354 ->isInstanceOf('mageekguy\atoum\exceptions\logic')355 ->hasMessage('Value is undefined')356 ->if($asserter->setWith(''))357 ->then358 ->object($integer = $asserter->length)...

Full Screen

Full Screen

getLocale

Using AI Code Generation

copy

Full Screen

1$asserter = new asserter();2echo $asserter->getLocale();3$asserter = new asserter();4$asserter->setLocale('en_US');5$asserter = new asserter();6echo $asserter->getLocale();7$asserter = new asserter();8$asserter->setLocale('fr_FR');9$asserter = new asserter();10echo $asserter->getLocale();11$asserter = new asserter();12$asserter->setLocale('en_US');13$asserter = new asserter();14echo $asserter->getLocale();15$asserter = new asserter();16$asserter->setLocale('fr_FR');17$asserter = new asserter();18echo $asserter->getLocale();19$asserter = new asserter();20$asserter->setLocale('en_US');21$asserter = new asserter();22echo $asserter->getLocale();23$asserter = new asserter();24$asserter->setLocale('fr_FR');25$asserter = new asserter();26echo $asserter->getLocale();27$asserter = new asserter();28$asserter->setLocale('en_US');

Full Screen

Full Screen

getLocale

Using AI Code Generation

copy

Full Screen

1$asserter = new asserter();2$asserter->getLocale();3$asserter = new asserter();4$asserter->getLocale();5$asserter = new asserter();6$asserter->getLocale();7$asserter = new asserter();8$asserter->getLocale();9$asserter = new asserter();10$asserter->getLocale();11$asserter = new asserter();12$asserter->getLocale();13$asserter = new asserter();14$asserter->getLocale();15$asserter = new asserter();16$asserter->getLocale();17$asserter = new asserter();18$asserter->getLocale();19$asserter = new asserter();20$asserter->getLocale();21$asserter = new asserter();22$asserter->getLocale();23$asserter = new asserter();24$asserter->getLocale();25$asserter = new asserter();26$asserter->getLocale();27$asserter = new asserter();28$asserter->getLocale();29$asserter = new asserter();30$asserter->getLocale();

Full Screen

Full Screen

getLocale

Using AI Code Generation

copy

Full Screen

1$asserter = new asserter();2$locale = $asserter->getLocale();3echo $locale;4$asserter = new asserter();5$locale = $asserter->setLocale('en_US');6echo $locale;7$asserter = new asserter();8$locale = $asserter->getLocale();9echo $locale;10$asserter = new asserter();11$locale = $asserter->setLocale('en_US');12echo $locale;13$asserter = new asserter();14$locale = $asserter->getLocale();15echo $locale;16$asserter = new asserter();17$locale = $asserter->setLocale('en_US');18echo $locale;19$asserter = new asserter();20$locale = $asserter->getLocale();21echo $locale;22$asserter = new asserter();23$locale = $asserter->setLocale('en_US');24echo $locale;25$asserter = new asserter();26$locale = $asserter->getLocale();27echo $locale;28$asserter = new asserter();29$locale = $asserter->setLocale('en_US');30echo $locale;31$asserter = new asserter();32$locale = $asserter->getLocale();33echo $locale;34$asserter = new asserter();35$locale = $asserter->setLocale('en_US');36echo $locale;37$asserter = new asserter();38$locale = $asserter->getLocale();39echo $locale;40$asserter = new asserter();41$locale = $asserter->setLocale('en_US');42echo $locale;43$asserter = new asserter();

Full Screen

Full Screen

getLocale

Using AI Code Generation

copy

Full Screen

1require_once 'PHPUnit/Framework/TestCase.php';2{3public function testGetLocale()4{5$asserter = new PHPUnit_Framework_Constraint_IsAnything();6$locale = $asserter->getLocale();7$this->assertEquals('en_US', $locale);8}9}10OK (1 test, 1 assertion)

Full Screen

Full Screen

getLocale

Using AI Code Generation

copy

Full Screen

1require_once 'simpletest/autorun.php';2require_once 'simpletest/web_tester.php';3class Test extends WebTestCase {4 function test() {5 $this->assertLocale('en_US');6 }7}8require_once 'simpletest/autorun.php';9require_once 'simpletest/web_tester.php';10class Test extends WebTestCase {11 function test() {12 $this->assertLocale('en_GB');13 }14}15require_once 'simpletest/autorun.php';16require_once 'simpletest/web_tester.php';17class Test extends WebTestCase {18 function test() {19 $this->assertLocale('fr_FR');20 }21}22require_once 'simpletest/autorun.php';23require_once 'simpletest/web_tester.php';24class Test extends WebTestCase {25 function test() {26 $this->assertLocale('fr_CA');27 }28}29require_once 'simpletest/autorun.php';30require_once 'simpletest/web_tester.php';31class Test extends WebTestCase {32 function test() {33 $this->assertLocale('de_DE');34 }35}36require_once 'simpletest/autorun.php';37require_once 'simpletest/web_tester.php';38class Test extends WebTestCase {39 function test() {40 $this->assertLocale('es_ES');41 }42}43require_once 'simpletest/autorun.php';

Full Screen

Full Screen

getLocale

Using AI Code Generation

copy

Full Screen

1$locale = $asserter->getLocale();2echo $locale;3$asserter->setLocale('en_US');4echo $asserter->getLocale();5$asserter->setLocale('fr_FR');6echo $asserter->getLocale();7$asserter->setLocale('it_IT');8echo $asserter->getLocale();9$asserter->setLocale('es_ES');10echo $asserter->getLocale();11$asserter->setLocale('de_DE');12echo $asserter->getLocale();13$asserter->setLocale('pt_BR');14echo $asserter->getLocale();15$asserter->setLocale('ru_RU');16echo $asserter->getLocale();17$asserter->setLocale('zh_CN');18echo $asserter->getLocale();19$asserter->setLocale('ja_JP');

Full Screen

Full Screen

getLocale

Using AI Code Generation

copy

Full Screen

1require_once 'simpletest/autorun.php';2class TestOfLocale extends UnitTestCase {3function testLocale() {4$this->assertLocale('en_US');5}6}7Related Posts: SimpleTest: How to use assertPattern() method8SimpleTest: How to use assertWantedPattern() method9SimpleTest: How to use assertNoPattern() method10SimpleTest: How to use assertNoUnwantedPattern() method11SimpleTest: How to use assertIdentical() method12SimpleTest: How to use assertNotIdentical() method13SimpleTest: How to use assertEqual() method14SimpleTest: How to use assertNotEqual() method15SimpleTest: How to use assertTrue() method16SimpleTest: How to use assertFalse() method17SimpleTest: How to use assertIsA() method18SimpleTest: How to use assertIsNotA() method19SimpleTest: How to use assertReference() method20SimpleTest: How to use assertClone() method21SimpleTest: How to use assertWithinMargin() method22SimpleTest: How to use assertOutsideMargin() method23SimpleTest: How to use assertWithinTolerance() method24SimpleTest: How to use assertOutsideTolerance() method25SimpleTest: How to use assertException() method26SimpleTest: How to use assertExceptionWithMessage() method27SimpleTest: How to use assertExceptionWithMessageRegExp() method28SimpleTest: How to use assertExceptionWithNoMessage() method29SimpleTest: How to use assertExceptionWithoutMessage() method30SimpleTest: How to use assertExceptionWithoutMessageRegExp() method31SimpleTest: How to use assertEqualArrays() method32SimpleTest: How to use assertEqualObjects() method33SimpleTest: How to use assertEqualXMLStructure() method

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger getLocale code on LambdaTest Cloud Grid

Execute automation tests with getLocale on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful