/** * @test */ public function it_applies_the_requested_relationship_to_the_query() { /** @var ModelStub $model */ $model = reader::readAttribute($this->repo, 'model'); $this->repo->with('all')->getAll(); $this->assertEquals(['author', 'comments'], $model->getRequestedRelationships()); }
public function testSetup() { $app = $this->getApp(); $tr = new TranslationFile($app, 'translations', 'en_GB'); $this->assertEquals('translations', \PHPUnit_Framework_Assert::readAttribute($tr, 'domain')); $this->assertEquals('en_GB', \PHPUnit_Framework_Assert::readAttribute($tr, 'locale')); }
/** * when input is sent to the constructor then initialize using the input */ public function testWhenInputIsSentToTheConstructorThenInitializeUsingTheInput() { $input = array('a' => 'b', 'c' => 'd'); $Collection = new \MySQLExtractor\Common\Collection($input); $elements = \PHPUnit_Framework_Assert::readAttribute($Collection, 'elements'); $this->assertEquals($input, $elements); }
public function testAdd() { $factory = new WidgetFactory(); $widget1 = \Mockery::mock('CSBill\\DashboardBundle\\Widgets\\WidgetInterface'); $widget2 = \Mockery::mock('CSBill\\DashboardBundle\\Widgets\\WidgetInterface'); $widget3 = \Mockery::mock('CSBill\\DashboardBundle\\Widgets\\WidgetInterface'); $widget4 = \Mockery::mock('CSBill\\DashboardBundle\\Widgets\\WidgetInterface'); $widget5 = \Mockery::mock('CSBill\\DashboardBundle\\Widgets\\WidgetInterface'); $factory->add($widget1, 'top', 100); $factory->add($widget2, 'left_column', 200); $factory->add($widget3, 'right_column', 300); $factory->add($widget4, null, 400); $factory->add($widget5, 'left_column'); $property = \PHPUnit_Framework_Assert::readAttribute($factory, 'queues'); $this->assertTrue(is_array($property)); $this->assertArrayHasKey('top', $property); $this->assertArrayHasKey('left_column', $property); $this->assertArrayHasKey('right_column', $property); $this->assertInstanceOf('SplPriorityQueue', $property['top']); $this->assertInstanceOf('SplPriorityQueue', $property['left_column']); $this->assertInstanceOf('SplPriorityQueue', $property['right_column']); $this->assertCount(2, $property['top']); $this->assertCount(2, $property['left_column']); $this->assertCount(1, $property['right_column']); }
public function testCustomConfigurationPassed() { $configuration = new GenericConfiguration(); $configuration->setLocale('nl-be')->setClientName('test')->setRequest(new Request()); $request = RequestFactory::createRequest($configuration); $this->assertSame($configuration, \PHPUnit_Framework_Assert::readAttribute($request, 'configuration')); }
public function testNamespaces() { $this->converter->addNamespace('http://www.example.com', 'some\\php\\ns'); $namespaces = \PHPUnit_Framework_Assert::readAttribute($this->converter, 'namespaces'); $this->assertArrayHasKey('http://www.example.com', $namespaces); $this->assertEquals('some\\php\\ns', $namespaces['http://www.example.com']); }
public function testTimeoutProperty() { $webshot = new Webshot(); $this->assertEquals(30, PHPUnit_Framework_Assert::readAttribute($webshot, 'timeout')); $webshot->setTimeout(10); $this->assertEquals(10, PHPUnit_Framework_Assert::readAttribute($webshot, 'timeout')); }
public function testContracts() { $this->assertTrue($this->reflectedObject->isAbstract()); $this->assertTrue($this->reflectedObject->hasMethod('cleanVar')); $this->assertTrue($this->reflectedObject->hasMethod('getVar')); $this->assertInstanceOf('\\Xoops\\Core\\Text\\Sanitizer', \PHPUnit_Framework_Assert::readAttribute($this->object, 'ts')); }
public function testLoadHttp() { MockTest::inject($this->_load, 'conf', ['conf' => ['tmp' => ['router' => MockTest::mockFileSystem([''])]]]); MockTest::inject($this->_load, 'routerYaml', MockTest::mockFile('router.yml')); $this->_load->loadHttp(); $this->assertInstanceOf('App\\Resource\\Http', \PHPUnit_Framework_Assert::readAttribute($this->_load, 'http')); }
public function testSetConfigValueValid() { $client = new Client(); $client->setConfig('scope', 'basic_user_info autoupload'); $config = PHPUnit_Framework_Assert::readAttribute($client, 'config'); $this->assertEquals('basic_user_info autoupload', $config->scope); }
public function testConstructor() { $_conf = \PHPUnit_Framework_Assert::readAttribute($this->ibc, 'conf'); $_query = \PHPUnit_Framework_Assert::readAttribute($this->ibc, 'query'); $this->assertInstanceOf('Conf\\Conf', $_conf); $this->assertInstanceOf('DataBase\\Query\\Query', $_query); }
public function testAddErrorsArray() { MockTest::inject($this->validatorFactory, 'errorArray', ['anyKey' => 'initState']); $errors = ['anyKey2' => 'anyErrors']; MockTest::callMockMethod($this->validatorFactory, 'addErrors', [$errors]); $this->assertEquals(\PHPUnit_Framework_Assert::readAttribute($this->validatorFactory, 'errorArray'), ['anyKey' => 'initState', 'anyKey2' => 'anyErrors']); }
public function testRequestFactory() { $configuration = new GenericConfiguration(); $configuration->setApiKey('12345')->setTrackingKey('trackkey')->setDigitalSign('dummydigitalsign')->setRequest(new Request()); $request = RequestFactory::createRequest($configuration); $this->assertSame($configuration, \PHPUnit_Framework_Assert::readAttribute($request, 'configuration')); }
/** * Test setting the attributes array. * * @covers ::setAttributes */ public function testSetAttributes() { $bag = new CasPropertyBag($this->randomMachineName(8)); $attributes = array('foo' => array('bar'), 'baz' => array('quux, foobar')); $bag->setAttributes($attributes); $this->assertEquals($attributes, \PHPUnit_Framework_Assert::readAttribute($bag, 'attributes')); }
public function testConstructor() { $_display = \PHPUnit_Framework_Assert::readAttribute($this->_controller, '_display'); $this->assertInstanceOf('Ignaszak\\Exception\\Modules\\Display', $_display); $_logFile = \PHPUnit_Framework_Assert::readAttribute($this->_controller, '_logFile'); $this->assertInstanceOf('Ignaszak\\Exception\\Modules\\LogFile', $_logFile); }
/** @test */ public function it_build_a_config_instance_from_array() { $classWithConfigAccess = new ClassWithConfigAccess(); $classWithConfigAccess->loadConfig(['youtubeKey' => '123456']); $this->assertEquals(new Config(['youtubeKey' => '123456']), PHPUnit_Framework_Assert::readAttribute($classWithConfigAccess, "config")); $this->assertEquals('123456', $classWithConfigAccess->config()->get('youtubeKey')); }
public function testConnect() { $app = $this->getApp(); $em = new EntityManager($app['db'], $app['dispatcher'], $app['storage.metadata']); $this->assertSame($app['db'], \PHPUnit_Framework_Assert::readAttribute($em, 'conn')); $this->assertSame($app['dispatcher'], \PHPUnit_Framework_Assert::readAttribute($em, 'eventManager')); }
public function testSetAgain() { $stub = $this->getMock('Ignaszak\\Registry\\Scope\\FileRegistry', ['get']); $stub->method('get')->willReturnSelf(); $stub->set('anyName', $stub); $this->assertInstanceOf(get_class($stub), \PHPUnit_Framework_Assert::readAttribute($stub, 'registryArray')['anyName']); }
/** * @test */ public function shouldSetBulkExportUri() { $expected_uri = 'contacts/exports'; $api = $this->getMockForAbstractClass('Eloqua\\Api\\Data\\Contact\\Bulk', array(), '', false); $this->assertEquals($expected_uri, $api->exports()); $this->assertEquals($expected_uri, \PHPUnit_Framework_Assert::readAttribute($api, '_mapUri')); }
public function testTemplateProperty() { $path = realpath(dirname(__FILE__)); $templateFile = $path . '/template/webshotter.php'; $webshot = new Webshot(null, $templateFile); $this->assertEquals($templateFile, PHPUnit_Framework_Assert::readAttribute($webshot, 'templatePath')); }
/** * Will update property value. * * @dataProvider dataProviderPropertyNames * @param $propertyName */ public function testWillUpdatePublicPropertyValue($propertyName) { $number = rand(1, 10); $this->instance->{$propertyName} = $number; $value = \PHPUnit_Framework_Assert::readAttribute($this->origin, $propertyName); static::assertEquals($number, $value); }
public function testGetSetterValue() { $command = \PHPUnit_Framework_Assert::readAttribute($this->validator, 'command'); MockTest::inject($command, 'entitySettersArray', ['setTitle' => 'value of setter']); $setter = MockTest::callMockMethod($this->validator, 'getSetter', ['title']); $this->assertEquals('value of setter', $setter); }
public function testSetup() { $app = $this->getApp(); $log = new Manager($app); $this->assertEquals('bolt_log_change', \PHPUnit_Framework_Assert::readAttribute($log, 'table_change')); $this->assertEquals('bolt_log_system', \PHPUnit_Framework_Assert::readAttribute($log, 'table_system')); }
public function testListGet() { // Set arbitrary list ID to retrieve $params = array('id' => 2); // Set expected data type $type = 'List'; // Retrieve list $response = $this->lists->listGet($params); // Check correct object was returned $this->assertInstanceOf('\\Rapi\\Response', $this->response); // Map the private result array to a readable variable $responseArray = PHPUnit_Framework_Assert::readAttribute($response, 'result'); // Check that status exists $this->assertTrue(array_key_exists('status', $responseArray)); // Check call was successful $this->assertEquals('success', $responseArray['status']); // Check that type exists $this->assertTrue(array_key_exists('type', $responseArray)); // Check correct response type was set $this->assertEquals($type, $responseArray['type']); // Check that data exists $this->assertTrue(array_key_exists('data', $responseArray)); // Check correct data was set $this->assertInstanceOf('\\StdClass', $responseArray['data']); $propertiesTest = array('id', 'name', 'description', 'entered', 'listorder', 'prefix', 'rssfeed', 'modified', 'active', 'owner', 'category'); // Check that all the correct properties are set foreach ($propertiesTest as $property) { $this->assertTrue(property_exists($responseArray['data'], $property)); } }
public function testCustomConfigurationPassed() { $configuration = new GenericConfiguration(); $configuration->setCountry('de')->setAccessKey('ABC')->setSecretKey('DEF')->setAssociateTag('apaiIOTest')->setRequest(new Request()); $request = RequestFactory::createRequest($configuration); $this->assertSame($configuration, \PHPUnit_Framework_Assert::readAttribute($request, 'configuration')); }
public function testReturnResultFromQueryBuilder() { $stub = \Mockery::mock('Entity\\Posts'); MockEntityController::mock('post', $stub); $entityName = \PHPUnit_Framework_Assert::readAttribute($this->query->setQuery('post'), 'entityName'); $this->assertEquals('Entity\\Posts', $entityName); }
public function testConstructor() { $opts = ['clientId' => 'foo', 'clientSecret' => 'bar']; $oauth = new BuddyOAuth(new BuddyClient(), $opts); $this->assertInstanceOf('Buddy\\BuddyClient', \PHPUnit_Framework_Assert::readAttribute($oauth, 'client')); $this->assertEquals($opts, \PHPUnit_Framework_Assert::readAttribute($oauth, 'options')); }
/** * @dataProvider provideDataOptionByMethod */ public function testSetOptionByMethod($method, $expect, $data) { $client = new RestClient("http://localhost"); $this->invokeMethod($client, "setOptionByMethod", [$method, $data]); $defaultOptions = \PHPUnit_Framework_Assert::readAttribute($client, 'options'); $this->assertSame($expect, $defaultOptions); }
public function testAddBuilderPass() { $builderPass = $this->getMock('Certificationy\\Component\\Certy\\Builder\\BuilderPassInterface'); $builder = new Builder(); $builder->addBuilderPass($builderPass); $this->assertEquals([$builderPass], \PHPUnit_Framework_Assert::readAttribute($builder, 'builderPass')); }
public function testSetBreadcrumbsArray() { $this->mockCategoryList(['anyCategory']); MockTest::callMockMethod($this->_categoryBc, 'setBreadcrumbsArray'); $breadcrumbsArray = \PHPUnit_Framework_Assert::readAttribute($this->_categoryBc, 'breadcrumbsArray'); $this->assertEquals(['anyCategory'], $breadcrumbsArray); }